Class SourceElementToModelTransformer

  • All Implemented Interfaces:
    SourceTransformer

    public class SourceElementToModelTransformer
    extends Object
    implements SourceTransformer
    A Source transformer transforming a SourceElement graph to a typed model.
    Version:
    $Id: $
    • Field Detail

      • NULL_ATTRIBUTE_FIELD_NAME

        public static final String NULL_ATTRIBUTE_FIELD_NAME
        The field name in the model which is filled if the attribute name null appears in the source graph.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SourceElementToModelTransformer

        public SourceElementToModelTransformer()
        Standard constructor.
      • SourceElementToModelTransformer

        public SourceElementToModelTransformer​(Class<?> modelRootClass)
        Constructor defining the model root class.
        Parameters:
        modelRootClass - the model root class, not null.
    • Method Detail

      • setModelRootClass

        public void setModelRootClass​(String modelRootClass)
        Sets the class which the model root must have.
        Parameters:
        modelRootClass - the class the model root must have, or null for any class
      • setIgnoreUnknownAttributes

        public void setIgnoreUnknownAttributes​(boolean ignoreUnknownAttributes)
        Sets whether to ignore unknown attributes in the source tree.
        Parameters:
        ignoreUnknownAttributes - true if unknown attributes should be ignored, false otherwise.
      • setIgnoreUnknownElements

        public void setIgnoreUnknownElements​(boolean ignoreUnknownElements)
        Sets whether to ignore unknown elements in the source tree.
        Parameters:
        ignoreUnknownElements - true if unknown elements should be ignored, false otherwise.
      • getInstance

        protected static Object getInstance​(String className,
                                            UnitConfiguration unitConfiguration)
                                     throws SourceTransformerException
        Creates an instance of a class.
        Parameters:
        className - the fully qualified name of the class to instantiate.
        unitConfiguration - The configuration of the generation unit, not null.
        Returns:
        the instance of the class
        Throws:
        SourceTransformerException - if the class cannot be instantiated.