Class ALcdGMLTypeMappingAnnotation

java.lang.Object
com.luciad.format.gmlcommon.transformation.ALcdGMLTypeMappingAnnotation
All Implemented Interfaces:
ILcdAnnotation
Direct Known Subclasses:
TLcdGML2TypeMappingAnnotation, TLcdGML31TypeMappingAnnotation, TLcdGML32TypeMappingAnnotation

public abstract class ALcdGMLTypeMappingAnnotation extends Object implements ILcdAnnotation
Maps and transforms a source data type to a given (GML) target data type.
If this annotation is present on a data type, TLcdGMLTransformer will map and transform that type to and from the given target type using the given transformation.

As an example, you could define and use a GregorianCalender type in your data model. You can map the type to an XML date type as follows:


 dataModelBuilder.typeBuilder("DateType").primitive(true).instanceClass(GregorianCalendar.class);
 TLcdDataModel dataModel = dataModelBuilder.createDataModel();
 TLcdDataType dateType = dataModel.getDeclaredType("DateType");
 dateType.addAnnotation(new TLcdGML32TypeMappingAnnotation(
   TLcdXMLBuiltInDataTypes.DateTime, new ALcdObjectTransformation() {

     public Object transform(Object aValue, Map<Object, Object> aContext) {
       return DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) aValue);
     }

     protected Object invert(Object aValue, Map<Object, Object> aContext) {
       return ((XMLGregorianCalendar) aValue).toGregorianCalendar();
     }
 }
 
Since:
11.0
See Also:
  • Constructor Details

    • ALcdGMLTypeMappingAnnotation

      public ALcdGMLTypeMappingAnnotation(TLcdDataType aType, ILcdObjectTransformation aTransformation)
      Creates a new instance. The data model that declares aType should be annotated with TLcdXMLSchemaMappingAnnotation and TLcdXMLSchemaTypeMappingAnnotation such that instances can be properly marshalled from and to XML.
      Parameters:
      aType - the type that is the GML representation of the type to which this annotation is added
      aTransformation - a transformation that can transform instances from the annotated type to the given type
  • Method Details

    • getType

      public TLcdDataType getType()
      Returns the GML representation of the annotated type.
      Returns:
      the GML representation of the annotated type
    • getTransformation

      public ILcdObjectTransformation getTransformation()
      Returns the transformation that is capable of transforming instances of the annotated type to instances of getType().
      Returns:
      the transformation from annotated type to GML type