Class TLcdTransformer

java.lang.Object
com.luciad.datamodel.transformation.TLcdTransformer
Direct Known Subclasses:
TLcdGMLTransformer

public class TLcdTransformer extends Object

Object that can transform an object from one model to another. Transformations are implemented by delegation to an appropriate ILcdObjectTransformation that is registered on this object's transformation provider.

This object is thread safe as long as the transformations that are registered on its provider are thread safe.

Since:
11.0
See Also:
  • Constructor Details

    • TLcdTransformer

      public TLcdTransformer()
  • Method Details

    • getProvider

      public TLcdObjectTransformationProvider getProvider()
      Returns the transformation provider used by this transformer to retrieve object transformations. The object transformation provider needs to be configured with appropriate transformation instances in order for this transformer to be able to perform any object transformations.
      Returns:
      the transformation provider used by this transformer to retrieve object transformations.
    • transform

      public Object transform(ILcdDataObject aObject)
      Transforms the given object with a new transformation context.

      The transformer will look in its provider for a transformation that can transform objects of the given type. If one such transformation is found, the object is transformed using that transformation. Otherwise an IllegalArgumentException is thrown to indicate that the object can't be transformed.

      Parameters:
      aObject - the object to transform
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
      See Also:
    • transformTo

      public Object transformTo(ILcdDataObject aObject, TLcdDataType aTargetType)
      Transforms the given object to the specified target type with a new given transformation context.
      Parameters:
      aObject - the object to transform
      aTargetType - the type of the transformed object
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
      See Also:
    • transform

      public Object transform(ILcdDataObject aObject, Map<Object,Object> aContext)
      Transforms the given object with the given transformation context.

      The transformer will look in its provider for a transformation that can transform objects of the given type. If one such transformation is found, the object is transformed using that transformation. Otherwise an IllegalArgumentException is thrown to indicate that the object can't be transformed.

      Parameters:
      aObject - the object to transform
      aContext - the transformation context
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
      See Also:
    • transformTo

      public Object transformTo(ILcdDataObject aObject, TLcdDataType aTargetType, Map<Object,Object> aContext)
      Transforms the given object to the specified target type with the given transformation context.
      Parameters:
      aObject - the object to transform
      aTargetType - the type of the transformed object
      aContext - the transformation context
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
      See Also:
    • transform

      public Object transform(Object aObject, TLcdDataType aType, Map<Object,Object> aContext)

      Transforms the given object of the specified type with the given transformation context.

      The object is assumed to be of the given type.

      The transformer will look in its provider for a transformation that can transform objects of the given type. If one such transformation is found, the object is transformed using that transformation. Otherwise an IllegalArgumentException is thrown to indicate that the object can't be transformed.

      Note that this method is typically called for objects that do not implement ILcdDataObject. It allows for instance to transform string values into integers.

      Parameters:
      aObject - the object to transform
      aType - the type of the object
      aContext - the transformation context
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
    • transformTo

      public Object transformTo(Object aObject, TLcdDataType aSourceType, TLcdDataType aTargetType, Map<Object,Object> aContext)

      Transforms the given object of the specified type to the specified target type with the given transformation context.

      The object is assumed to be of the given source type. The transformer will look in its provider for a transformation that can transform objects between the given types If one such transformation is found, the object is transformed using that transformation. Otherwise an IllegalArgumentException is thrown to indicate that the object can't be transformed.

      Note that this method is typically called for objects that do not implement ILcdDataObject. It allows for instance to transform string values into integers.

      Parameters:
      aObject - the object to transform
      aSourceType - the type of the original object
      aTargetType - the type of the transformed object
      aContext - the transformation context
      Returns:
      the transformed object
      Throws:
      IllegalArgumentException - if the object cannot be transformed
    • getInverse

      public TLcdTransformer getInverse()
      Gets the inverse of this transformer.
      Returns:
      the inverse of this transformer.
    • createTransformationContext

      public Map<Object,Object> createTransformationContext()
      Creates a new transformation context. This transformation context is passed as parameter when objects are transformed. This makes it possible for transformations to share information during the transformation.
      Returns:
      a new mapping context