use of org.apache.tapestry5.commons.internal.services.AnnotationDataTypeAnalyzer in project tapestry-5 by apache.
the class BasicDataTypeAnalyzers method contributeDataTypeAnalyzer.
public static void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer> configuration, DataTypeAnalyzer defaultDataTypeAnalyzer) {
configuration.add("Annotation", new AnnotationDataTypeAnalyzer());
if (defaultDataTypeAnalyzer == null) {
defaultDataTypeAnalyzer = createDefaultDataTypeAnalyzer();
}
configuration.add("Default", defaultDataTypeAnalyzer, "after:*");
}
use of org.apache.tapestry5.commons.internal.services.AnnotationDataTypeAnalyzer in project tapestry-5 by apache.
the class BasicDataTypeAnalyzers method createDefaultDataTypeAnalyzer.
public static DataTypeAnalyzer createDefaultDataTypeAnalyzer() {
DefaultDataTypeAnalyzerMappedConfiguration mappedConfiguration = new DefaultDataTypeAnalyzerMappedConfiguration();
provideDefaultDataTypeAnalyzers(mappedConfiguration);
return new CombinedDataTypeAnalyzer(new AnnotationDataTypeAnalyzer(), new DefaultDataTypeAnalyzer(mappedConfiguration.getMap()));
}
use of org.apache.tapestry5.commons.internal.services.AnnotationDataTypeAnalyzer in project tapestry-5 by apache.
the class TapestryModule method contributeDataTypeAnalyzer.
/**
* <dl>
* <dt>Annotation</dt>
* <dd>Checks for {@link org.apache.tapestry5.beaneditor.DataType} annotation</dd>
* <dt>Default (ordered last)</dt>
* <dd>
* {@link org.apache.tapestry5.commons.internal.services.DefaultDataTypeAnalyzer} service (
* {@link #contributeDefaultDataTypeAnalyzer(org.apache.tapestry5.commons.MappedConfiguration)} )</dd>
* </dl>
*/
public static void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer> configuration, @InjectService("DefaultDataTypeAnalyzer") DataTypeAnalyzer defaultDataTypeAnalyzer) {
configuration.add("Annotation", new AnnotationDataTypeAnalyzer());
configuration.add("Default", defaultDataTypeAnalyzer, "after:*");
}
use of org.apache.tapestry5.commons.internal.services.AnnotationDataTypeAnalyzer in project tapestry-5 by apache.
the class AnnotationDataTypeAnalyzerTest method value_from_annotation.
@Test
public void value_from_annotation() {
String value = "password";
PropertyAdapter adapter = mockPropertyAdapter();
train_getAnnotation(adapter, DataType.class, mockDataType(value));
replay();
DataTypeAnalyzer analyzer = new AnnotationDataTypeAnalyzer();
assertEquals(analyzer.identifyDataType(adapter), value);
verify();
}
use of org.apache.tapestry5.commons.internal.services.AnnotationDataTypeAnalyzer in project tapestry-5 by apache.
the class AnnotationDataTypeAnalyzerTest method annotation_absent.
@Test
public void annotation_absent() {
PropertyAdapter adapter = mockPropertyAdapter();
train_getAnnotation(adapter, DataType.class, null);
replay();
DataTypeAnalyzer analyzer = new AnnotationDataTypeAnalyzer();
assertNull(analyzer.identifyDataType(adapter));
verify();
}
Aggregations