Package org.beanio.internal.parser
Class CollectionBean
- java.lang.Object
-
- org.beanio.internal.util.TreeNode<Component>
-
- org.beanio.internal.parser.Component
-
- org.beanio.internal.parser.PropertyComponent
-
- org.beanio.internal.parser.CollectionBean
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<Component>
,Property
,Replicateable
public class CollectionBean extends PropertyComponent implements Property
AProperty
that stores children in aCollection
.If a child property is missing or null, null is added to the collection.
- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class org.beanio.internal.parser.PropertyComponent
createMissingBeans
-
Fields inherited from interface org.beanio.internal.parser.Property
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE
-
-
Constructor Summary
Constructors Constructor Description CollectionBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearValue(ParsingContext context)
Clears the property value.java.lang.Object
createValue(ParsingContext context)
Creates the property value and returns it.boolean
defines(java.lang.Object value)
java.lang.Object
getValue(ParsingContext context)
Returns the value of this property.protected java.lang.Object
newInstance()
Creates a new instance of this bean object.void
registerLocals(java.util.Set<ParserLocal<? extends java.lang.Object>> locals)
Called by a stream to register variables stored in the parsing context.void
setValue(ParsingContext context, java.lang.Object value)
Sets the property value (before marshalling).int
type()
Returns the property type.-
Methods inherited from class org.beanio.internal.parser.PropertyComponent
getAccessor, getType, isIdentifier, isMatchNull, isRequired, isSupportedChild, setAccessor, setIdentifier, setMatchNull, setRequired, setType, toParamString
-
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferences
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.beanio.internal.parser.Property
getAccessor, getName, getType, isIdentifier, setAccessor, setIdentifier, setType
-
-
-
-
Method Detail
-
type
public int type()
Description copied from interface:Property
Returns the property type.- Specified by:
type
in interfaceProperty
- Returns:
Property.SIMPLE
,Property.COMPLEX
,Property.AGGREGATION_ARRAY
,Property.COLLECTION
,Property.AGGREGATION_COLLECTION
, orProperty.MAP
-
clearValue
public void clearValue(ParsingContext context)
Description copied from interface:Property
Clears the property value. A subsequent call toProperty.getValue(ParsingContext)
should return null, orValue.MISSING
for lazy property values.- Specified by:
clearValue
in interfaceProperty
- Parameters:
context
- theParsingContext
-
createValue
public java.lang.Object createValue(ParsingContext context)
Description copied from interface:Property
Creates the property value and returns it.- Specified by:
createValue
in interfaceProperty
- Parameters:
context
- theParsingContext
- Returns:
- the property value
-
getValue
public java.lang.Object getValue(ParsingContext context)
Description copied from interface:Property
Returns the value of this property.When unmarshalling, this method should return
Value.MISSING
if the field was not present in the stream. Or if present, but has no value, null should be returned.When marshalling, this method should return
Value.MISSING
for any optional segment bound to a bean object, or null if required. Null field properties should always returnValue.MISSING
.- Specified by:
getValue
in interfaceProperty
- Parameters:
context
- theParsingContext
- Returns:
- the property value,
or
Value.MISSING
if not present in the stream, orValue.INVALID
if the field was invalid
-
setValue
public void setValue(ParsingContext context, java.lang.Object value)
Description copied from interface:Property
Sets the property value (before marshalling).- Specified by:
setValue
in interfaceProperty
- Parameters:
context
- theParsingContext
value
- the property value
-
newInstance
protected java.lang.Object newInstance()
Creates a new instance of this bean object.- Returns:
- the new bean
Object
-
registerLocals
public void registerLocals(java.util.Set<ParserLocal<? extends java.lang.Object>> locals)
Description copied from class:Component
Called by a stream to register variables stored in the parsing context. This method should be overridden by subclasses that need to register one or more parser context variables.- Overrides:
registerLocals
in classComponent
- Parameters:
locals
- set of local variables
-
-