net.sf.jsefa.xml.annotation
Class XmlTypeMappingFactory

java.lang.Object
  extended by net.sf.jsefa.common.annotation.TypeMappingFactory<QName,XmlTypeMappingRegistry>
      extended by net.sf.jsefa.xml.annotation.XmlTypeMappingFactory

public final class XmlTypeMappingFactory
extends TypeMappingFactory<QName,XmlTypeMappingRegistry>

Factory for creating TypeMappings from annotated classes.

It is thread safe.

Author:
Norman Lahme-Huetig, Matthias Derer

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jsefa.common.annotation.TypeMappingFactory
TypeMappingFactory.TypeMappingPlaceholder
 
Constructor Summary
XmlTypeMappingFactory(XmlTypeMappingRegistry typeMappingRegistry, SimpleTypeConverterProvider simpleTypeConverterProvider, ValidatorProvider validatorProvider, ObjectAccessorProvider objectAccessorProvider, XmlDataTypeDefaultNameRegistry dataTypeDefaultNameRegistry)
          Constructs a new XmlTypeMappingFactory.
 
Method Summary
 QName createIfAbsent(Class<?> objectType)
          Creates a new TypeMapping for the given object type from its annotations if it is not already registered in the type mapping registry given to the constructor of the class.
protected  QName 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

XmlTypeMappingFactory

public XmlTypeMappingFactory(XmlTypeMappingRegistry typeMappingRegistry,
                             SimpleTypeConverterProvider simpleTypeConverterProvider,
                             ValidatorProvider validatorProvider,
                             ObjectAccessorProvider objectAccessorProvider,
                             XmlDataTypeDefaultNameRegistry dataTypeDefaultNameRegistry)
Constructs a new XmlTypeMappingFactory.

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
dataTypeDefaultNameRegistry - the data type default name registry to use
Method Detail

createIfAbsent

public QName createIfAbsent(Class<?> objectType)
Creates a new TypeMapping for the given object type from its annotations if it is not already registered in the type mapping registry given to the constructor of the class. The resulting type mapping will be registered in the type mapping registry under the returned name.

Additional type mappings will be created and registered recursivly if necessary.

Specified by:
createIfAbsent in class TypeMappingFactory<QName,XmlTypeMappingRegistry>
Parameters:
objectType - the object type
Returns:
the name of the created type mapping. The type mapping itself can be retrieved using the type mapping registry.

getAnnotatedDataTypeName

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

Specified by:
getAnnotatedDataTypeName in class TypeMappingFactory<QName,XmlTypeMappingRegistry>
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.