net.sf.jsefa.rbf.annotation
Class RbfTypeMappingFactory

java.lang.Object
  extended by net.sf.jsefa.common.annotation.TypeMappingFactory<String,RbfTypeMappingRegistry>
      extended by net.sf.jsefa.rbf.annotation.RbfTypeMappingFactory
Direct Known Subclasses:
CsvTypeMappingFactory, FlrTypeMappingFactory

public abstract class RbfTypeMappingFactory
extends TypeMappingFactory<String,RbfTypeMappingRegistry>

Factory for creating TypeMappings from annotated classes.

It is thread-safe and all subclasses must be thread-safe, too.

Author:
Norman Lahme-Huetig

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jsefa.common.annotation.TypeMappingFactory
TypeMappingFactory.TypeMappingPlaceholder
 
Constructor Summary
RbfTypeMappingFactory(RbfTypeMappingRegistry typeMappingRegistry, SimpleTypeConverterProvider simpleTypeConverterProvider, ValidatorProvider validatorProvider, ObjectAccessorProvider objectAccessorProvider, RbfAnnotations annotations)
          Constructs a new AbstractRbfTypeMappingFactory.
 
Method Summary
 String createIfAbsent(Class<?> objectType)
          Creates a type mapping for the given object type and returns its name.
protected abstract  TypeMapping<String> createSimpleTypeMapping(Class<?> objectType, String dataTypeName, SimpleTypeConverter converter, Field field)
          Creates a new simple type mapping.
protected  String getAnnotatedDataTypeName(Annotation annotation, Class<?> annotationContextClass)
          Returns the data type name as declared through the given annotation.
 
Methods inherited from class net.sf.jsefa.common.annotation.TypeMappingFactory
assertHasSimpleType, assertNoCollectionType, assertTypeMappingExists, assertTypeMappingIsSimple, createSimpleTypeConverter, getCollectionItemType, getMapKeyType, getMapValueType, getObjectAccessorProvider, getSimpleTypeConverterProvider, getTypeMappingRegistry, getValidatorFactory, getValidatorProvider, hasCollectionType, hasMapType, hasSimpleType, prepareToCreate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RbfTypeMappingFactory

public RbfTypeMappingFactory(RbfTypeMappingRegistry typeMappingRegistry,
                             SimpleTypeConverterProvider simpleTypeConverterProvider,
                             ValidatorProvider validatorProvider,
                             ObjectAccessorProvider objectAccessorProvider,
                             RbfAnnotations annotations)
Constructs a new AbstractRbfTypeMappingFactory.

Parameters:
typeMappingRegistry - the type mapping registry. New types will be registered using that registry.
simpleTypeConverterProvider - the simple type converter provider to use
validatorProvider - the validator provider to use
objectAccessorProvider - the object accessor provider to use
annotations - the parameter objects providing the annotation classes to use.
Method Detail

createIfAbsent

public final String createIfAbsent(Class<?> objectType)
Creates a type mapping for the given object type and returns its name.

Specified by:
createIfAbsent in class TypeMappingFactory<String,RbfTypeMappingRegistry>
Parameters:
objectType - the object type.
Returns:
the type mapping name.

createSimpleTypeMapping

protected abstract TypeMapping<String> createSimpleTypeMapping(Class<?> objectType,
                                                               String dataTypeName,
                                                               SimpleTypeConverter converter,
                                                               Field field)
Creates a new simple type mapping.

Parameters:
objectType - the object type
dataTypeName - the data type name
converter - the converter
field - the field
Returns:
the simple type mapping.

getAnnotatedDataTypeName

protected String getAnnotatedDataTypeName(Annotation annotation,
                                          Class<?> annotationContextClass)
Returns the data type name as declared through the given annotation.

Specified by:
getAnnotatedDataTypeName in class TypeMappingFactory<String,RbfTypeMappingRegistry>
Parameters:
annotation - the annotation
annotationContextClass - the context class of the annotation. This class may be needed to interpret the annotation data.
Returns:
a data type name


Copyright © 2014. All rights reserved.