BeanIO 2.0.4

org.beanio.internal.config
Class PropertyConfig

java.lang.Object
  extended by org.beanio.internal.util.TreeNode<ComponentConfig>
      extended by org.beanio.internal.config.ComponentConfig
          extended by org.beanio.internal.config.PropertyConfig
All Implemented Interfaces:
Cloneable, 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:

Since:
2.0
Author:
Kevin Seim

Field Summary
static String JSON_TYPE_ARRAY
           
static String JSON_TYPE_BOOLEAN
           
static String JSON_TYPE_NONE
           
static String JSON_TYPE_NUMBER
           
static String JSON_TYPE_OBJECT
           
static String JSON_TYPE_STRING
           
 
Fields inherited from class org.beanio.internal.config.ComponentConfig
CONSTANT, FIELD, GROUP, RECORD, SEGMENT, STREAM, WRAPPER
 
Constructor Summary
PropertyConfig()
          Constructs a new PropertyConfig.
 
Method Summary
 String getCollection()
          Returns the collection type, or null if this component is not bound to a collection or array.
 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.
 String getJsonName()
          Returns the JSON field name if different that the property name.
 String getJsonType()
          Returns the JSON type.
 String getKey()
          Returns the name of the property descendant to use for the Map key when collection is set to map.
 Integer getMaxOccurs()
          Returns the maximum number of times this component may consecutively appear in a stream.
 int getMaxSize()
          Returns the maximum size of one occurrence of this component (based on its field length or the field length of its descendants).
 Integer getMinOccurs()
          Returns the minimum number of times this component must appear in the stream.
 int getMinSize()
          Returns the minimum size of this component (based on its field length or the field length of its descendants).
 Integer getPosition()
          Returns the position of this component.
 String getSetter()
          Returns the name of the setter method to use when setting this property's value on its parent bean object during unmarshalling.
 String getType()
          Returns the fully qualified class name or type alias of this property.
 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.
 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()
           
 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(String collection)
          Sets the collection type.
 void setGetter(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(String jsonName)
          Sets the JSON field name.
 void setJsonType(String jsonType)
          Sets the JSON type.
 void setMaxOccurs(Integer maxOccurs)
          Sets the maximum number of times this component may consecutively appear in a stream.
 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(Integer minOccurs)
          Sets the minimum number of times this component must consecutively appear in a stream.
 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 setPosition(Integer position)
          Sets the position of this component.
 void setSetter(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(String type)
          Sets the fully qualified class name or type alias of this property.
 void setUntil(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(String xmlType)
          Sets the XML node type of this component.
 
Methods inherited from class org.beanio.internal.config.ComponentConfig
getComponentType, getXmlName, getXmlNamespace, getXmlPrefix, isXmlNamespaceAware, setXmlName, setXmlNamespace, setXmlNamespaceAware, setXmlPrefix
 
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, iterator, print, setName, size, sort, toParamString, toString, updateReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JSON_TYPE_NONE

public static final String JSON_TYPE_NONE
See Also:
Constant Field Values

JSON_TYPE_ARRAY

public static final String JSON_TYPE_ARRAY
See Also:
Constant Field Values

JSON_TYPE_OBJECT

public static final String JSON_TYPE_OBJECT
See Also:
Constant Field Values

JSON_TYPE_BOOLEAN

public static final String JSON_TYPE_BOOLEAN
See Also:
Constant Field Values

JSON_TYPE_NUMBER

public static final String JSON_TYPE_NUMBER
See Also:
Constant Field Values

JSON_TYPE_STRING

public static final String JSON_TYPE_STRING
See Also:
Constant Field Values
Constructor Detail

PropertyConfig

public PropertyConfig()
Constructs a new PropertyConfig.

Method Detail

getType

public 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(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 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(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 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(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

getPosition

public 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(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 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(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 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(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 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(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 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(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

getXmlType

public String getXmlType()
Returns the XML node type of this component.

Returns:
the XML node type
See Also:
XmlTypeConstants

setXmlType

public void setXmlType(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 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(String jsonName)
Sets the JSON field name.

Parameters:
jsonName - the JSON field name

getJsonType

public String getJsonType()
Returns the JSON type.

Returns:
the JSON type

setJsonType

public void setJsonType(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 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

isSupportedChild

protected boolean isSupportedChild(ComponentConfig child)
Description copied from class: TreeNode
Returns whether a node is a supported child of this node. Called by TreeNode.add(TreeNode).

Overrides:
isSupportedChild in class TreeNode<ComponentConfig>
Parameters:
child - the node to test
Returns:
true if the child is allowed

isLazy

public boolean isLazy()

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim