Class TemplateElementBase

Direct Known Subclasses:
MappingElementBase, TemplateElement

public abstract class TemplateElementBase extends ContainerElementBase
Model component for elements that define how instances of a particular class are converted to or from XML. This includes both mapping and template elements.
Author:
Dennis M. Sosnoski
  • Field Details

    • s_allowedAttributes

      public static final StringArray s_allowedAttributes
      Enumeration of allowed attribute names
    • m_className

      private String m_className
      Name of handled class.
    • m_handledClass

      private IClass m_handledClass
      Handled class information.
    • m_topChildren

      protected ArrayList m_topChildren
      List of child elements.
    • m_extensionTypes

      private ArrayList m_extensionTypes
      Templates or mappings that can be used in place of this one (as substitution group using mapping, or xsi:type with template).
  • Constructor Details

    • TemplateElementBase

      public TemplateElementBase(int type)
      Constructor.
      Parameters:
      type - element type code
  • Method Details

    • setClassName

      public void setClassName(String name)
      Set mapped class name.
      Parameters:
      name - mapped class name
    • getClassName

      public String getClassName()
      Get mapped class name.
      Returns:
      class name
    • getHandledClass

      public IClass getHandledClass()
      Get handled class information. This call is only meaningful after prevalidation.
      Returns:
      mapped class information
    • addExtensionType

      protected void addExtensionType(TemplateElementBase ext)
      Add template or mapping which derives from this one.
      Parameters:
      ext - derived template or mapping information
    • getExtensionTypes

      public ArrayList getExtensionTypes()
      Get templates or mappings which derive from this one.
      Returns:
      list of derived templates or mappings
    • isDefaultTemplate

      public abstract boolean isDefaultTemplate()
      Check if default template for type. Needs to be implemented by subclasses for common handling.
      Returns:
      true if default for type, false if not
    • addTopChild

      public void addTopChild(Object child)
      Add top-level child element.
      Parameters:
      child - element to be added as child of this element
    • topChildren

      public ArrayList topChildren()
      Get list of top-level child elements.
      Returns:
      list of child elements, or null if none
    • topChildIterator

      public Iterator topChildIterator()
      Get iterator for top-level child elements.
      Returns:
      iterator for child elements
    • isOptional

      public boolean isOptional()
    • getType

      public IClass getType()
    • isImplicit

      public boolean isImplicit()
    • hasObject

      public boolean hasObject()
      Description copied from class: ContainerElementBase
      Check if this container defines a context object.
      Specified by:
      hasObject in class ContainerElementBase
      Returns:
      true if defines context object, false if not
    • getObjectType

      public IClass getObjectType()
      Description copied from class: ContainerElementBase
      Get class linked to binding element. This call is only meaningful after validation.
      Specified by:
      getObjectType in class ContainerElementBase
      Returns:
      information for class linked by binding
    • prevalidate

      public void prevalidate(ValidationContext vctx)
      Description copied from class: ElementBase
      Prevalidate element information. The prevalidation step is used to check isolated aspects of an element, such as the settings for enumerated values on the element and attributes. This empty base class implementation should be overridden by each subclass that requires prevalidation handling.
      Overrides:
      prevalidate in class ContainerElementBase
      Parameters:
      vctx - validation context
    • validate

      public void validate(ValidationContext vctx)
      Description copied from class: ElementBase
      Validate element information. The validation step is used for checking the interactions between elements, such as name references to other elements. The ElementBase.prevalidate(org.jibx.binding.model.ValidationContext) method will always be called for every element in the binding definition before this method is called for any element. This empty base class implementation should be overridden by each subclass that requires validation handling.
      Overrides:
      validate in class ContainerElementBase
      Parameters:
      vctx - validation context