001/*
002 *  Copyright 2011 Christopher Pheby
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.jadira.bindings.core.binder.adapter;
017
018import java.lang.annotation.Annotation;
019
020import org.jadira.bindings.core.binder.ConversionBinder;
021import org.jadira.bindings.core.binder.StringBinder;
022
023public class StringBinderAdapter implements StringBinder {
024
025        private ConversionBinder binder;
026
027        public StringBinderAdapter(ConversionBinder binder) {
028                this.binder = binder;
029        }
030
031        /**
032         * {@inheritDoc}
033         */
034        /* @Override */
035        public <T> T convertFromString(Class<T> output, String object) {
036                return binder.convertTo(String.class, output, object);
037        }
038
039        /**
040         * {@inheritDoc}
041         */
042        /* @Override */
043        public <T> T convertFromString(Class<T> output, String object, Class<? extends Annotation> qualifier) {
044                return binder.convertTo(String.class, output, object, qualifier);
045        }
046
047        /**
048         * {@inheritDoc}
049         */
050        /* @Override */
051        public String convertToString(Object object) {
052                return binder.convertTo(String.class, object);
053        }
054
055        /**
056         * {@inheritDoc}
057         */
058        /* @Override */
059        public String convertToString(Object object, Class<? extends Annotation> qualifier) {
060                return binder.convertTo(String.class, object, qualifier);
061        }
062
063        /**
064         * {@inheritDoc}
065         */
066        /* @Override */
067        public <S> String convertToString(Class<S> input, Object object) {
068                return binder.convertTo(input, String.class, object);
069        }
070
071        /**
072         * {@inheritDoc}
073         */
074        /* @Override */
075        public <S> String convertToString(Class<S> input, Object object,
076                        Class<? extends Annotation> qualifier) {
077                return binder.convertTo(input, String.class, object, qualifier);
078        }
079
080        /**
081         * {@inheritDoc}
082         */
083        /* @Override */
084        public ConversionBinder getAssociatedBinder() {
085                return binder;
086        }
087}