Class CollectionElement

  • All Implemented Interfaces:
    IComponent

    public class CollectionElement
    extends StructureElementBase
    Model component for collection element of binding definition.
    Version:
    1.0
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • s_allowedAttributes

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

        private java.lang.String m_loadMethodName
        Load method name.
      • m_sizeMethodName

        private java.lang.String m_sizeMethodName
        Size method name.
      • m_storeMethodName

        private java.lang.String m_storeMethodName
        Store method name.
      • m_addMethodName

        private java.lang.String m_addMethodName
        Add method name.
      • m_iterMethodName

        private java.lang.String m_iterMethodName
        Iterator method name.
      • m_itemTypeName

        private java.lang.String m_itemTypeName
        Item type name.
      • m_loadMethodItem

        private IClassItem m_loadMethodItem
        Load method information.
      • m_sizeMethodItem

        private IClassItem m_sizeMethodItem
        Size method information.
      • m_storeMethodItem

        private IClassItem m_storeMethodItem
        Store method information.
      • m_addMethodItem

        private IClassItem m_addMethodItem
        Add method information.
      • m_iterMethodItem

        private IClassItem m_iterMethodItem
        Iterator method information.
      • m_itemTypeClass

        private IClass m_itemTypeClass
        Item type information.
    • Constructor Detail

      • CollectionElement

        public CollectionElement()
        Default constructor.
    • Method Detail

      • getItemTypeName

        public java.lang.String getItemTypeName()
        Get item type name.
        Returns:
        item type name (or null if none)
      • setItemTypeName

        public void setItemTypeName​(java.lang.String type)
        Set item type name.
        Parameters:
        type - item type name (or null if none)
      • getItemTypeClass

        public IClass getItemTypeClass()
        Get item type information. This call is only meaningful after validation.
        Returns:
        item type information
      • getAddMethodName

        public java.lang.String getAddMethodName()
        Get add method name.
        Returns:
        add method name (or null if none)
      • setAddMethodName

        public void setAddMethodName​(java.lang.String name)
        Set add method name.
        Parameters:
        name - add method name (or null if none)
      • getAddMethodItem

        public IClassItem getAddMethodItem()
        Get add method information. This call is only meaningful after validation.
        Returns:
        add method information (or null if none)
      • getIterMethodName

        public java.lang.String getIterMethodName()
        Get iterator method name.
        Returns:
        iterator method name (or null if none)
      • setIterMethodName

        public void setIterMethodName​(java.lang.String name)
        Set iterator method name.
        Parameters:
        name - iterator method name (or null if none)
      • getIterMethodItem

        public IClassItem getIterMethodItem()
        Get iterator method information. This call is only meaningful after validation.
        Returns:
        iterator method information (or null if none)
      • getLoadMethodName

        public java.lang.String getLoadMethodName()
        Get load method name.
        Returns:
        load method name (or null if none)
      • setLoadMethodName

        public void setLoadMethodName​(java.lang.String name)
        Set load method name.
        Parameters:
        name - load method name (or null if none)
      • getLoadMethodItem

        public IClassItem getLoadMethodItem()
        Get load method information. This call is only meaningful after validation.
        Returns:
        load method information (or null if none)
      • getSizeMethodName

        public java.lang.String getSizeMethodName()
        Get size method name.
        Returns:
        size method name (or null if none)
      • setSizeMethodName

        public void setSizeMethodName​(java.lang.String name)
        Set size method name.
        Parameters:
        name - size method name (or null if none)
      • getSizeMethodItem

        public IClassItem getSizeMethodItem()
        Get size method information. This call is only meaningful after validation.
        Returns:
        size method information (or null if none)
      • getStoreMethodName

        public java.lang.String getStoreMethodName()
        Get store method name.
        Returns:
        store method name (or null if none)
      • setStoreMethodName

        public void setStoreMethodName​(java.lang.String name)
        Set store method name.
        Parameters:
        name - store method name (or null if none)
      • getStoreMethodItem

        public IClassItem getStoreMethodItem()
        Get store method information. This call is only meaningful after validation.
        Returns:
        store method information (or null if none)
      • setIdChild

        public boolean setIdChild​(IComponent child)
        Set ID property. This is never supported for an object coming from a collection.
        Parameters:
        child - child defining the ID property
        Returns:
        true if successful, false if ID already defined
      • hasObject

        public boolean hasObject()
        Check for object present. Always true for collection.
        Overrides:
        hasObject in class StructureElementBase
        Returns:
        true
      • 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 StructureElementBase
        Parameters:
        vctx - validation context
      • checkCollectionChildren

        private boolean checkCollectionChildren​(ValidationContext vctx,
                                                IClass type,
                                                java.util.ArrayList children)
        Check that child components are of types compatible with the collection item-type. This method may call itself recursively to process the children of child components which do not themselves set a type. The result is used for recursive checking to detect conditions where an inner structure defines a type but an outer one does not (which causes errors in the current code generation).
        Parameters:
        vctx - validation context
        type - collection item type
        children - list of child components to be checked
        Returns:
        true if only child is a <value> element with type, false if not
      • checkUnorderedChildren

        private void checkUnorderedChildren​(ValidationContext vctx,
                                            java.util.ArrayList children)
        Check children of unordered collection for consistency. In an input binding each child element must define a unique qualified name. In an output binding each child element must define a unique type or supply a test method to allow checking when that element should be generated for an object.
        Parameters:
        vctx - validation context
        children - list of child components
      • checkOrderedChildren

        private void checkOrderedChildren​(ValidationContext vctx,
                                          java.util.ArrayList children)
        Check children of ordered collection for consistency. In an input binding each child element must use a different qualified name from the preceding child element. In an output binding each child element must define a different type from the preceding child element, or the preceding child element must supply a test method to allow checking when that element should be generated for an object.
        Parameters:
        vctx - validation context
        children - list of child components
      • 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 StructureElementBase
        Parameters:
        vctx - validation context