View Javadoc
1   /*
2    *  Copyright 2011 Christopher Pheby
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.jadira.bindings.core.binder.adapter;
17  
18  import java.lang.annotation.Annotation;
19  
20  import org.jadira.bindings.core.binder.ConversionBinder;
21  import org.jadira.bindings.core.binder.StringBinder;
22  
23  public class StringBinderAdapter implements StringBinder {
24  
25  	private ConversionBinder binder;
26  
27  	public StringBinderAdapter(ConversionBinder binder) {
28  		this.binder = binder;
29  	}
30  
31  	/**
32  	 * {@inheritDoc}
33  	 */
34  	/* @Override */
35  	public <T> T convertFromString(Class<T> output, String object) {
36  		return binder.convertTo(String.class, output, object);
37  	}
38  
39  	/**
40  	 * {@inheritDoc}
41  	 */
42  	/* @Override */
43  	public <T> T convertFromString(Class<T> output, String object, Class<? extends Annotation> qualifier) {
44  		return binder.convertTo(String.class, output, object, qualifier);
45  	}
46  
47  	/**
48  	 * {@inheritDoc}
49  	 */
50  	/* @Override */
51  	public String convertToString(Object object) {
52  		return binder.convertTo(String.class, object);
53  	}
54  
55  	/**
56  	 * {@inheritDoc}
57  	 */
58  	/* @Override */
59  	public String convertToString(Object object, Class<? extends Annotation> qualifier) {
60  		return binder.convertTo(String.class, object, qualifier);
61  	}
62  
63  	/**
64  	 * {@inheritDoc}
65  	 */
66  	/* @Override */
67  	public <S> String convertToString(Class<S> input, Object object) {
68  		return binder.convertTo(input, String.class, object);
69  	}
70  
71  	/**
72  	 * {@inheritDoc}
73  	 */
74  	/* @Override */
75  	public <S> String convertToString(Class<S> input, Object object,
76  			Class<? extends Annotation> qualifier) {
77  		return binder.convertTo(input, String.class, object, qualifier);
78  	}
79  
80  	/**
81  	 * {@inheritDoc}
82  	 */
83  	/* @Override */
84  	public ConversionBinder getAssociatedBinder() {
85  		return binder;
86  	}
87  }