View Javadoc

1   /*
2    * Copyright 2004-2005, 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph;
17  
18  import net.sf.morph.lang.languages.SimpleLanguage;
19  import net.sf.morph.reflect.BeanReflector;
20  import net.sf.morph.reflect.ContainerReflector;
21  import net.sf.morph.reflect.DecoratedReflector;
22  import net.sf.morph.reflect.GrowableContainerReflector;
23  import net.sf.morph.reflect.IndexedContainerReflector;
24  import net.sf.morph.reflect.InstantiatingReflector;
25  import net.sf.morph.reflect.MutableIndexedContainerReflector;
26  import net.sf.morph.reflect.SizableReflector;
27  import net.sf.morph.reflect.reflectors.SimpleDelegatingReflector;
28  import net.sf.morph.transform.DecoratedConverter;
29  import net.sf.morph.transform.DecoratedCopier;
30  import net.sf.morph.transform.DecoratedTransformer;
31  import net.sf.morph.transform.converters.DefaultToTextConverter;
32  import net.sf.morph.transform.converters.NumberConverter;
33  import net.sf.morph.transform.converters.ObjectToPrettyTextConverter;
34  import net.sf.morph.transform.converters.TextConverter;
35  import net.sf.morph.transform.converters.TimeConverter;
36  import net.sf.morph.transform.copiers.ContainerCopier;
37  import net.sf.morph.transform.transformers.SimpleDelegatingTransformer;
38  
39  /**
40   * Default instances of the main objects that are used repeatedly in the
41   * framework.
42   * 
43   * @author Matt Sgarlata
44   * @since Jan 9, 2005
45   */
46  public abstract class Defaults {
47  
48  	/**
49  	 * Create a basic DecoratedReflector.
50  	 * @return DecoratedReflector
51  	 */
52  	public static final DecoratedReflector createReflector() {
53  		return new SimpleDelegatingReflector();
54  	}
55  
56  	/**
57  	 * Create a basic BeanReflector.
58  	 * @return BeanReflector
59  	 */
60  	public static final BeanReflector createBeanReflector() {
61  		return new SimpleDelegatingReflector();
62  	}
63  
64  	/**
65  	 * Create a basic ContainerReflector.
66  	 * @return ContainerReflector
67  	 */
68  	public static final ContainerReflector createContainerReflector() {
69  		return new SimpleDelegatingReflector();
70  	}
71  
72  	/**
73  	 * Create a basic GrowableContainerReflector.
74  	 * @return GrowableContainerReflector
75  	 */
76  	public static final GrowableContainerReflector createGrowableContainerReflector() {
77  		return new SimpleDelegatingReflector();
78  	}
79  
80  	/**
81  	 * Create a basic IndexedContainerReflector.
82  	 * @return IndexedContainerReflector
83  	 */
84  	public static final IndexedContainerReflector createIndexedContainerReflector() {
85  		return new SimpleDelegatingReflector();
86  	}
87  
88  	/**
89  	 * Create a basic InstantiatingReflector.
90  	 * @return InstantiatingReflector
91  	 */
92  	public static final InstantiatingReflector createInstantiatingReflector() {
93  		return new SimpleDelegatingReflector();
94  	}
95  
96  	/**
97  	 * Create a basic MutableIndexedContainerReflector.
98  	 * @return MutableIndexedContainerReflector
99  	 */
100 	public static final MutableIndexedContainerReflector createMutableIndexedContainerReflector() {
101 		return new SimpleDelegatingReflector();
102 	}
103 
104 	/**
105 	 * Create a basic SizableReflector.
106 	 * @return SizableReflector
107 	 */
108 	public static final SizableReflector createSizableReflector() {
109 		return new SimpleDelegatingReflector();
110 	}
111 
112 	/**
113 	 * Create a basic DecoratedTransformer.
114 	 * @return DecoratedTransformer
115 	 */
116 	public static final DecoratedTransformer createTransformer() {
117 		return new SimpleDelegatingTransformer();
118 	}
119 
120 	/**
121 	 * Create a basic DecoratedConverter.
122 	 * @return DecoratedConverter
123 	 */
124 	public static final DecoratedConverter createConverter() {
125 		return new SimpleDelegatingTransformer();
126 	}
127 
128 	/**
129 	 * Create a basic DecoratedCopier.
130 	 * @return DecoratedCopier
131 	 */
132 	public static final DecoratedCopier createCopier() {
133 		return new SimpleDelegatingTransformer();
134 	}
135 
136 	/**
137 	 * Create a basic TextConverter.
138 	 * @return TextConverter
139 	 */
140 	public static final TextConverter createTextConverter() {
141 		return new TextConverter();
142 	}
143 
144 	/**
145 	 * Create a basic DefaultToTextConverter.
146 	 * @return DefaultToTextConverter
147 	 */
148 	public static final DefaultToTextConverter createToTextConverter() {
149 		return new DefaultToTextConverter();
150 	}
151 
152 	/**
153 	 * Create a basic TimeConverter.
154 	 * @return TimeConverter
155 	 */
156 	public static final TimeConverter createTimeConverter() {
157 		return new TimeConverter();
158 	}
159 
160 	/**
161 	 * Create a basic NumberConverter.
162 	 * @return NumberConverter
163 	 */
164 	public static final NumberConverter createNumberConverter() {
165 		return new NumberConverter();
166 	}
167 
168 	/**
169 	 * Create a basic pretty text converter.
170 	 * @return DecoratedConverter
171 	 */
172 	public static final DecoratedConverter createPrettyTextConverter() {
173 		return new ObjectToPrettyTextConverter();
174 	}
175 
176 	/**
177 	 * Create a basic ContainerCopier.
178 	 * @return ContainerCopier
179 	 */
180 	public static final ContainerCopier createContainerCopier() {
181 		return new ContainerCopier();
182 	}
183 
184 	/**
185 	 * Create a basic Language.
186 	 * @return SimpleLanguage
187 	 */
188 	public static final SimpleLanguage createLanguage() {
189 		return new SimpleLanguage();
190 	}
191 
192 }