Class StructureElementBase

  • All Implemented Interfaces:
    IComponent
    Direct Known Subclasses:
    CollectionElement, StructureElement

    public abstract class StructureElementBase
    extends ContainerElementBase
    implements IComponent
    Model component for elements that define the binding structure for an object property. This is the base class for structure and collection elements.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • s_allowedAttributes

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

        private PropertyAttributes m_propertyAttrs
        Property attributes information for nesting.
      • m_nameAttrs

        private NameAttributes m_nameAttrs
        Name attributes information for nesting.
      • m_collectionItem

        private boolean m_collectionItem
        Flag for child of collection element (only meaningful after prevalidation).
    • Constructor Detail

      • StructureElementBase

        protected StructureElementBase​(int type)
        Constructor.
        Parameters:
        type - element type code
    • Method Detail

      • getName

        public java.lang.String getName()
        Get name.
        Specified by:
        getName in interface IComponent
        Returns:
        name text
      • setName

        public void setName​(java.lang.String name)
        Set name.
        Parameters:
        name - text for name
      • getUri

        public java.lang.String getUri()
        Get specified namespace URI.
        Specified by:
        getUri in interface IComponent
        Returns:
        namespace URI (null if not set)
      • setUri

        public void setUri​(java.lang.String uri)
        Set namespace URI.
        Parameters:
        uri - namespace URI (null if not set)
      • getPrefix

        public java.lang.String getPrefix()
        Get specified namespace prefix.
        Returns:
        namespace prefix (null if not set)
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Set namespace prefix.
        Parameters:
        prefix - namespace prefix (null if not set)
      • getNamespace

        public NamespaceElement getNamespace()
        Get effective namespace information. This call is only meaningful after validation.
        Returns:
        effective namespace information
      • getUsageName

        public java.lang.String getUsageName()
        Get usage name.
        Returns:
        usage name
      • setUsageName

        public void setUsageName​(java.lang.String name)
        Set usage name.
        Parameters:
        name - usage name
      • setUsage

        public void setUsage​(int use)
        Set usage value.
        Parameters:
        use - value
      • hasProperty

        public boolean hasProperty()
        Check if property is defined. This method is only meaningful after a call to prevalidate(ValidationContext).
        Returns:
        true if property defined, false if not
      • isFlagOnly

        public boolean isFlagOnly()
        Check if property is flag only. This method is only meaningful after a call to prevalidate(ValidationContext).
        Returns:
        true if flag property, false if not
      • getDeclaredType

        public java.lang.String getDeclaredType()
        Get declared type name.
        Returns:
        type name (or null if none)
      • setDeclaredType

        public void setDeclaredType​(java.lang.String type)
        Set declared type name.
        Parameters:
        type - name (or null if none)
      • getFieldName

        public java.lang.String getFieldName()
        Get field name.
        Returns:
        field name (or null if none)
      • setFieldName

        public void setFieldName​(java.lang.String field)
        Set field name.
        Parameters:
        field - field name (or null if none)
      • getTestName

        public java.lang.String getTestName()
        Get test method name.
        Returns:
        test method name (or null if none)
      • setTestName

        public void setTestName​(java.lang.String test)
        Set test method name.
        Parameters:
        test - test method name (or null if none)
      • setFlagName

        public void setFlagName​(java.lang.String flag)
        Set flag method name.
        Parameters:
        flag - flag method name (or null if none)
      • getGetName

        public java.lang.String getGetName()
        Get get method name.
        Returns:
        get method name (or null if none)
      • getGetType

        public IClass getGetType()
        Get type for value loaded to stack. This call is only meaningful after a call to prevalidate(ValidationContext).
        Returns:
        get value type (or null if none)
      • setGetName

        public void setGetName​(java.lang.String get)
        Set get method name.
        Parameters:
        get - get method name (or null if none)
      • getSetName

        public java.lang.String getSetName()
        Get set method name.
        Returns:
        set method name (or null if none)
      • getSetType

        public IClass getSetType()
        Get type for value stored from stack. This call is only meaningful after a call to prevalidate(ValidationContext).
        Returns:
        set value type (or null if none)
      • setSetName

        public void setSetName​(java.lang.String set)
        Set set method name.
        Parameters:
        set - set method name (or null if none)
      • isImplicit

        public boolean isImplicit()
        Check if this value implicitly uses the containing object. This call is only meaningful after a call to prevalidate(ValidationContext).
        Specified by:
        isImplicit in interface IComponent
        Returns:
        true if using the containing object, false if own value
      • isOptional

        public boolean isOptional()
        Description copied from interface: IComponent
        Check if component is an optional item.
        Specified by:
        isOptional in interface IComponent
        Returns:
        true if optional, false if required
      • 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
      • hasAttribute

        public boolean hasAttribute()
        Description copied from interface: IComponent
        Check if component defines one or more attribute values of the containing element. This method is only valid after validation.
        Specified by:
        hasAttribute in interface IComponent
        Returns:
        true if one or more attribute values defined for containing element, false if not
      • hasContent

        public boolean hasContent()
        Description copied from interface: IComponent
        Check if component defines one or more elements or text values as children of the containing element. This method is only valid after validation.
        Specified by:
        hasContent in interface IComponent
        Returns:
        true if one or more content values defined for containing element, false if not
      • hasName

        public boolean hasName()
        Description copied from interface: IComponent
        Check if component has a name.
        Specified by:
        hasName in interface IComponent
        Returns:
        true if component has a name, false if not
      • getType

        public IClass getType()
        Description copied from interface: IComponent
        Get value type information. This call is only meaningful after prevalidation.
        Specified by:
        getType in interface IComponent
        Returns:
        type information
      • 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