|
BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.beanio.internal.util.TreeNode<Component>
org.beanio.internal.parser.Component
org.beanio.internal.parser.ParserComponent
org.beanio.internal.parser.DelegatingParser
org.beanio.internal.parser.Aggregation
org.beanio.internal.parser.CollectionParser
public class CollectionParser
A CollectionParser provides iteration support for a Segment or Field,
and is optionally bound to a Collection type property value.
A CollectionParser must contain exactly one child ParserComponent.
| Field Summary |
|---|
| Fields inherited from class org.beanio.internal.parser.Aggregation |
|---|
maxOccurs, minOccurs |
| Fields inherited from interface org.beanio.internal.parser.Property |
|---|
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE |
| Constructor Summary | |
|---|---|
CollectionParser()
Constructs a new CollectionParser. |
|
| Method Summary | |
|---|---|
void |
clearValue(ParsingContext context)
Clears the current property value. |
protected Collection<Object> |
createCollection()
|
Object |
createValue(ParsingContext context)
Creates the property value and returns it. |
boolean |
defines(Object value)
|
protected Collection<Object> |
getCollection(ParsingContext context)
Returns the collection value being parsed. |
int |
getIterationIndex(ParsingContext context)
Returns the index of the current iteration relative to its parent. |
int |
getIterationSize()
Returns the size of the components that make up a single iteration. |
Object |
getNullValue()
|
Class<? extends Collection<Object>> |
getType()
|
Object |
getValue(ParsingContext context)
Returns the unmarshalled property value. |
boolean |
hasContent(ParsingContext context)
Returns whether this parser or any of its descendant have content for marshalling. |
protected boolean |
isInvalid(ParsingContext context)
Returns whether this iteration contained invalid values when last unmarshalled. |
boolean |
isProperty()
Returns whether this iteration is a property of a bean object. |
boolean |
marshal(MarshallingContext context)
Marshals a record. |
boolean |
matches(UnmarshallingContext context)
Returns whether this parser and its children match a record being unmarshalled. |
void |
registerLocals(Set<ParserLocal<? extends Object>> locals)
Called by a stream to register variables stored in the parsing context. |
void |
setType(Class<?> collectionType)
|
void |
setValue(ParsingContext context,
Object value)
Sets the property value for marshaling. |
protected void |
toParamString(StringBuilder s)
Called by TreeNode.toString() to append node parameters to the output. |
int |
type()
Returns the property type. |
boolean |
unmarshal(UnmarshallingContext context)
Unmarshals a record. |
| Methods inherited from class org.beanio.internal.parser.Aggregation |
|---|
getAccessor, getMaxOccurs, getMinOccurs, isIdentifier, isLazy, setAccessor, setIdentifier, setMaxOccurs, setMinOccurs |
| Methods inherited from class org.beanio.internal.parser.DelegatingParser |
|---|
getParser, getSize |
| Methods inherited from class org.beanio.internal.parser.ParserComponent |
|---|
isSupportedChild |
| Methods inherited from class org.beanio.internal.util.TreeNode |
|---|
add, clone, find, getChildren, getFirst, getName, iterator, 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 |
|---|
getName |
| Methods inherited from interface org.beanio.internal.parser.Parser |
|---|
getName |
| Constructor Detail |
|---|
public CollectionParser()
| Method Detail |
|---|
public void clearValue(ParsingContext context)
Parser
clearValue in interface ParserclearValue in interface PropertyclearValue in class DelegatingParsercontext - the ParsingContextpublic boolean defines(Object value)
public boolean matches(UnmarshallingContext context)
Parser
matches in interface Parsermatches in class DelegatingParsercontext - the UnmarshallingContext
public boolean marshal(MarshallingContext context)
throws IOException
Parser
marshal in interface Parsermarshal in class DelegatingParsercontext - the MarshallingContext
IOException - if an I/O error occurspublic boolean unmarshal(UnmarshallingContext context)
Parser
unmarshal in interface Parserunmarshal in class DelegatingParsercontext - the UnmarshallingContext
public boolean isProperty()
isProperty in class Aggregationprotected boolean isInvalid(ParsingContext context)
protected Collection<Object> getCollection(ParsingContext context)
Collectionpublic void setType(Class<?> collectionType)
public Class<? extends Collection<Object>> getType()
public Object getNullValue()
public Object createValue(ParsingContext context)
Property
context - the ParsingContext
public Object getValue(ParsingContext context)
Parser
getValue in interface ParsergetValue in interface PropertygetValue in class DelegatingParsercontext - the ParsingContext
public void setValue(ParsingContext context,
Object value)
Parser
setValue in interface ParsersetValue in interface PropertysetValue in class DelegatingParsercontext - the ParsingContextvalue - the property valueprotected Collection<Object> createCollection()
public int type()
Property
Property.SIMPLE, Property.COMPLEX, Property.AGGREGATION_ARRAY, Property.COLLECTION,
Property.AGGREGATION_COLLECTION, or Property.MAPpublic int getIterationSize()
Iteration
public int getIterationIndex(ParsingContext context)
Iteration
public void registerLocals(Set<ParserLocal<? extends Object>> locals)
Component
registerLocals in class Componentlocals - set of local variablespublic boolean hasContent(ParsingContext context)
Parser
hasContent in interface ParserhasContent in class DelegatingParsercontext - the ParsingContext
protected void toParamString(StringBuilder s)
TreeNodeTreeNode.toString() to append node parameters to the output.
toParamString in class TreeNode<Component>s - the output to append
|
BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||