Class PropertyConfig

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<ComponentConfig>, Replicateable
    Direct Known Subclasses:
    GroupConfig, SegmentConfig, SimplePropertyConfig

    public abstract class PropertyConfig
    extends ComponentConfig
    A base class for configuration components that can be bound to a property of a bean object.

    The following attributes are set during compilation, and are meant for internal use only:

    • minSize
    • maxSize
    Since:
    2.0
    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyConfig()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCollection()
      Returns the collection type, or null if this component is not bound to a collection or array.
      java.lang.String getGetter()
      Returns the name of the getter method for retrieving this property's value from its parent bean object during marshalling.
      int getJsonArrayIndex()
      Returns the index of this property in its parent JSON array.
      java.lang.String getJsonName()
      Returns the JSON field name if different that the property name.
      java.lang.String getJsonType()
      Returns the JSON type.
      java.lang.String getKey()
      Returns the name of the property descendant to use for the Map key when collection is set to map.
      java.lang.String getLabel()
      Returns the component name used for identification in error handling.
      java.lang.Integer getMaxOccurs()
      Returns the maximum number of times this component may consecutively appear in a stream.
      java.lang.Integer getMaxOccursRef()
      Returns the maximum allowed value of the referenced occurs field.
      int getMaxSize()
      Returns the maximum size of one occurrence of this component (based on its field length or the field length of its descendants).
      java.lang.Integer getMinOccurs()
      Returns the minimum number of times this component must appear in the stream.
      java.lang.Integer getMinOccursRef()
      Returns the minimum required value of the referenced occurs field.
      int getMinSize()
      Returns the minimum size of this component (based on its field length or the field length of its descendants).
      java.lang.String getOccursRef()
      Returns the name of a field in the same record that indicates the number of occurrences for this component.
      java.lang.Integer getPosition()
      Returns the position of this component.
      java.lang.String getSetter()
      Returns the name of the setter method to use when setting this property's value on its parent bean object during unmarshalling.
      java.lang.String getType()
      Returns the fully qualified class name or type alias of this property.
      java.lang.Integer getUntil()
      Returns the excluded maximum position of this component which may be specified for components that repeat indefinitely, A negative number is counted from the end of the record.
      java.lang.String getXmlType()
      Returns the XML node type of this component.
      boolean isBound()
      Returns whether this property is bound to its parent bean object.
      boolean isCollection()
      Returns whether this component is bound to a collection or array.
      boolean isIdentifier()
      Returns whether this component is used to identify a record during unmarshalling or a bean during marshalling.
      boolean isJsonArray()
      Returns whether the property is mapped to a JSON array.
      boolean isLazy()
      Returns whether the class assigned to this segment should only be instantiated if at least one child element is not null or the empty string, or if null should be returned for an empty collection.
      boolean isNillable()
      Returns whether this component is nillable.
      boolean isRepeating()
      Returns whether this component repeats in a stream.
      protected boolean isSupportedChild​(ComponentConfig child)
      Returns whether a node is a supported child of this node.
      void setBound​(boolean bound)
      Sets whether this property is bound to its parent bean object.
      void setCollection​(java.lang.String collection)
      Sets the collection type.
      void setGetter​(java.lang.String getter)
      Sets the name of the getter method for retrieving this property's value from it parent bean object during marshalling.
      void setIdentifier​(boolean b)
      Sets whether this component is used to identify a record during unmarshalling or a bean during marshalling.
      void setJsonArray​(boolean jsonArray)
      Sets whether this property is mapped to a JSON array.
      void setJsonArrayIndex​(int jsonArrayIndex)
      Sets the index of this property in its parent JSON array.
      void setJsonName​(java.lang.String jsonName)
      Sets the JSON field name.
      void setJsonType​(java.lang.String jsonType)
      Sets the JSON type.
      void setLabel​(java.lang.String label)
      Sets the component name used for identification in error handling.
      void setLazy​(boolean lazy)
      Sets whether the property assigned to this segment should only be instantiated if at least one child element is not null or the empty string, or if null should be returned instead for an empty collection.
      void setMaxOccurs​(java.lang.Integer maxOccurs)
      Sets the maximum number of times this component may consecutively appear in a stream.
      void setMaxOccursRef​(java.lang.Integer maxOccursRef)
      Sets the maximum allowed value of the referenced occurs field.
      void setMaxSize​(int maxSize)
      Sets the maximum size of one occurrence of this component (based on its field length or the field length of its descendants).
      void setMinOccurs​(java.lang.Integer minOccurs)
      Sets the minimum number of times this component must consecutively appear in a stream.
      void setMinOccursRef​(java.lang.Integer minOccursRef)
      Sets the minimum required value of the referenced occurs field.
      void setMinSize​(int minSize)
      Sets the minimum size of this component (based on its field length or the field length of its descendants).
      void setNillable​(boolean nillable)
      Sets whether this component is nillable.
      void setOccursRef​(java.lang.String occursRef)
      Sets the name of a field in the same record that indicates the number of occurrences for this component.
      void setPosition​(java.lang.Integer position)
      Sets the position of this component.
      void setSetter​(java.lang.String setter)
      Sets the name of the setter method to use when setting this property's value on its parent bean object during unmarshalling.
      void setType​(java.lang.String type)
      Sets the fully qualified class name or type alias of this property.
      void setUntil​(java.lang.Integer until)
      Sets the excluded maximum position of this component which may be specified for components that repeat indefinitely, A negative number is counted from the end of the record.
      void setXmlType​(java.lang.String xmlType)
      Sets the XML node type of this component.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • PropertyConfig

        public PropertyConfig()
    • Method Detail

      • getLabel

        public java.lang.String getLabel()
        Returns the component name used for identification in error handling. Defaults to getName() if not set.
        Returns:
        the component name
      • setLabel

        public void setLabel​(java.lang.String label)
        Sets the component name used for identification in error handling.
        Parameters:
        label - the component name
      • getType

        public java.lang.String getType()
        Returns the fully qualified class name or type alias of this property. By default, null is returned and the property value type is detected through bean introspection.
        Returns:
        the class name of this property value
      • setType

        public void setType​(java.lang.String type)
        Sets the fully qualified class name or type alias of this property. If set to null, the property value type will be detected through bean introspection if possible.
        Parameters:
        type - the class name of this property value
      • getGetter

        public java.lang.String getGetter()
        Returns the name of the getter method for retrieving this property's value from its parent bean object during marshalling.
        Returns:
        the getter method for this property
      • setGetter

        public void setGetter​(java.lang.String getter)
        Sets the name of the getter method for retrieving this property's value from it parent bean object during marshalling. If null, the getter method may be discovered through bean introspection if possible.
        Parameters:
        getter - the getter method for this property
      • getSetter

        public java.lang.String getSetter()
        Returns the name of the setter method to use when setting this property's value on its parent bean object during unmarshalling.
        Returns:
        the setter method for this property
      • setSetter

        public void setSetter​(java.lang.String setter)
        Sets the name of the setter method to use when setting this property's value on its parent bean object during unmarshalling. If null, the setter method may be discovered through bean introspection if possible.
        Parameters:
        setter - the setter method for this property
      • isBound

        public boolean isBound()
        Returns whether this property is bound to its parent bean object.
        Returns:
        true if bound, false otherwise
      • setBound

        public void setBound​(boolean bound)
        Sets whether this property is bound to its parent bean object.
        Parameters:
        bound - true if bound, false otherwise
      • isLazy

        public boolean isLazy()
        Returns whether the class assigned to this segment should only be instantiated if at least one child element is not null or the empty string, or if null should be returned for an empty collection.
        Returns:
        whether this component is lazy
      • setLazy

        public void setLazy​(boolean lazy)
        Sets whether the property assigned to this segment should only be instantiated if at least one child element is not null or the empty string, or if null should be returned instead for an empty collection.
        Parameters:
        lazy - the new lazy value
      • getPosition

        public java.lang.Integer getPosition()
        Returns the position of this component. A negative number is counted from the end of the record (e.g. -1 is the last field in the record).

        For delimited record formats, the position is the index (beginning at 0) of this component in the record. For fixed length record formats, the position is the index of the first character in the component.

        A negative number is counted from the end of the record.

        Returns:
        the field position
      • setPosition

        public void setPosition​(java.lang.Integer position)
        Sets the position of this component. A negative number is counted from the end of the record (e.g. -1 is the last field in the record).

        For delimited record formats, the position is the index (beginning at 0) of this component in the record. For fixed length record formats, the position is the index of the first character in the component.

        Parameters:
        position - the field position
      • getUntil

        public java.lang.Integer getUntil()
        Returns the excluded maximum position of this component which may be specified for components that repeat indefinitely, A negative number is counted from the end of the record.
        Returns:
        the maximum position
      • setUntil

        public void setUntil​(java.lang.Integer until)
        Sets the excluded maximum position of this component which may be specified for components that repeat indefinitely, A negative number is counted from the end of the record.
        Parameters:
        until - the maximum position
      • getCollection

        public java.lang.String getCollection()
        Returns the collection type, or null if this component is not bound to a collection or array.
        Returns:
        the collection type
      • setCollection

        public void setCollection​(java.lang.String collection)
        Sets the collection type. Set to null (default) to indicate this component is not bound to a collection or array. The value may be set to the fully qualified class name of a java.util.Collection subclass or a collection type alias, or the value "array" to indicate a Java array.
        Parameters:
        collection - the collection type
      • getMinOccurs

        public java.lang.Integer getMinOccurs()
        Returns the minimum number of times this component must appear in the stream.
        Returns:
        the minimum occurrences of this component
      • setMinOccurs

        public void setMinOccurs​(java.lang.Integer minOccurs)
        Sets the minimum number of times this component must consecutively appear in a stream. If set to any value greater than one, a collection type is expected. Must be 0 or greater.
        Parameters:
        minOccurs - the minimum occurrences of this component
      • getMaxOccurs

        public java.lang.Integer getMaxOccurs()
        Returns the maximum number of times this component may consecutively appear in a stream. If null, one occurrence is assumed.
        Returns:
        the maximum occurrences of this component, or -1 to indicate no limit
      • setMaxOccurs

        public void setMaxOccurs​(java.lang.Integer maxOccurs)
        Sets the maximum number of times this component may consecutively appear in a stream. If set to null, one occurrence is assumed. If set to any value greater than one, a collection type is expected. Must be greater than the minimum occurrences, or set to -1 to indicate the limit is unbounded.
        Parameters:
        maxOccurs - the maximum occurrences of this component, or -1 to indicate no limit
      • getOccursRef

        public java.lang.String getOccursRef()
        Returns the name of a field in the same record that indicates the number of occurrences for this component.
        Returns:
        the field name
      • setOccursRef

        public void setOccursRef​(java.lang.String occursRef)
        Sets the name of a field in the same record that indicates the number of occurrences for this component.
        Parameters:
        occursRef - the field name
      • getMinOccursRef

        public java.lang.Integer getMinOccursRef()
        Returns the minimum required value of the referenced occurs field.
        Returns:
        the minimum value
      • setMinOccursRef

        public void setMinOccursRef​(java.lang.Integer minOccursRef)
        Sets the minimum required value of the referenced occurs field.
        Parameters:
        minOccursRef - the minimum value
      • getMaxOccursRef

        public java.lang.Integer getMaxOccursRef()
        Returns the maximum allowed value of the referenced occurs field.
        Returns:
        the maximum value
      • setMaxOccursRef

        public void setMaxOccursRef​(java.lang.Integer maxOccursRef)
        Sets the maximum allowed value of the referenced occurs field.
        Parameters:
        maxOccursRef - the maximum value
      • getXmlType

        public java.lang.String getXmlType()
        Returns the XML node type of this component.
        Returns:
        the XML node type
        See Also:
        XmlTypeConstants
      • setXmlType

        public void setXmlType​(java.lang.String xmlType)
        Sets the XML node type of this component.
        Parameters:
        xmlType - the XML node type
        See Also:
        XmlTypeConstants
      • isNillable

        public boolean isNillable()
        Returns whether this component is nillable.
        Returns:
        true if this component is nillable
      • setNillable

        public void setNillable​(boolean nillable)
        Sets whether this component is nillable.
        Parameters:
        nillable - true if this component is nillable
      • getJsonName

        public java.lang.String getJsonName()
        Returns the JSON field name if different that the property name. Ignored if its parent is a JSON array.
        Returns:
        the JSON field name
      • setJsonName

        public void setJsonName​(java.lang.String jsonName)
        Sets the JSON field name.
        Parameters:
        jsonName - the JSON field name
      • getJsonType

        public java.lang.String getJsonType()
        Returns the JSON type.
        Returns:
        the JSON type
      • setJsonType

        public void setJsonType​(java.lang.String jsonType)
        Sets the JSON type.
        Parameters:
        jsonType - the JSON type
      • isJsonArray

        public boolean isJsonArray()
        Returns whether the property is mapped to a JSON array. Set internally by BeanIO.
        Returns:
        true if this property is mapped to a JSON array, false otherwise
      • setJsonArray

        public void setJsonArray​(boolean jsonArray)
        Sets whether this property is mapped to a JSON array. Set internally by BeanIO.
        Parameters:
        jsonArray - true if this property is mapped to a JSON array, false otherwise
      • getJsonArrayIndex

        public int getJsonArrayIndex()
        Returns the index of this property in its parent JSON array.
        Returns:
        the array index, or -1 if not applicable
      • setJsonArrayIndex

        public void setJsonArrayIndex​(int jsonArrayIndex)
        Sets the index of this property in its parent JSON array.
        Parameters:
        jsonArrayIndex - the array index, or -1 if not applicable
      • isIdentifier

        public boolean isIdentifier()
        Returns whether this component is used to identify a record during unmarshalling or a bean during marshalling. If this component is a record or segment, true is returned if any descendent is used for identification.
        Returns:
        true if this component is used for identification
      • setIdentifier

        public void setIdentifier​(boolean b)
        Sets whether this component is used to identify a record during unmarshalling or a bean during marshalling.
        Parameters:
        b - true if this component is used for identification
      • getMinSize

        public int getMinSize()
        Returns the minimum size of this component (based on its field length or the field length of its descendants).
        Returns:
        the minimum size of this component
      • setMinSize

        public void setMinSize​(int minSize)
        Sets the minimum size of this component (based on its field length or the field length of its descendants).
        Parameters:
        minSize - the minimum size of this component
      • getMaxSize

        public int getMaxSize()
        Returns the maximum size of one occurrence of this component (based on its field length or the field length of its descendants).
        Returns:
        the maximum size of this component
      • setMaxSize

        public void setMaxSize​(int maxSize)
        Sets the maximum size of one occurrence of this component (based on its field length or the field length of its descendants).
        Parameters:
        maxSize - the maximum size of this component
      • isCollection

        public boolean isCollection()
        Returns whether this component is bound to a collection or array.
        Returns:
        true if this component is bound to a collection or array
      • isRepeating

        public boolean isRepeating()
        Returns whether this component repeats in a stream. The component is assumed to repeat if bound to a collection or the maximum occurrences is greater than one.
        Returns:
        true if this component repeats
      • getKey

        public java.lang.String getKey()
        Returns the name of the property descendant to use for the Map key when collection is set to map.
        Returns:
        the key property name