public class CollectionParser extends Aggregation
Segment
or Field
,
and is optionally bound to a Collection
type property value.
A CollectionParser must contain exactly one child ParserComponent
.
Type | Property and Description |
---|---|
boolean |
is
Gets the value of the property property.
|
lazy, occurs
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE
Constructor and Description |
---|
CollectionParser()
Constructs a new CollectionParser.
|
Modifier and Type | Method and Description |
---|---|
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 |
getIterationSize()
Returns the size of the components that make up a single iteration.
|
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()
Gets the value of the property property.
|
protected int |
length(Object value)
Returns the length of aggregation.
|
protected boolean |
marshal(MarshallingContext context,
Parser delegate,
int minOccurs,
int maxOccurs) |
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.
|
protected boolean |
unmarshal(UnmarshallingContext context,
Parser delegate,
int minOccurs,
int maxOccurs) |
getAccessor, getIterationIndex, getMaxOccurs, getMinOccurs, getOccurs, isDynamicIteration, isIdentifier, isLazy, isOptional, marshal, setAccessor, setIdentifier, setIterationIndex, setLazy, setMaxOccurs, setMinOccurs, setOccurs, unmarshal
getParser, getSize
isSupportedChild
add, clone, find, getChildren, getFirst, getName, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferences
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public boolean isProperty
isProperty
in class Aggregation
public void clearValue(ParsingContext context)
Parser
clearValue
in interface Parser
clearValue
in interface Property
clearValue
in class DelegatingParser
context
- the ParsingContext
public boolean defines(Object value)
public boolean matches(UnmarshallingContext context)
Parser
matches
in interface Parser
matches
in class DelegatingParser
context
- the UnmarshallingContext
protected boolean marshal(MarshallingContext context, Parser delegate, int minOccurs, int maxOccurs) throws IOException
marshal
in class Aggregation
IOException
protected boolean unmarshal(UnmarshallingContext context, Parser delegate, int minOccurs, int maxOccurs)
unmarshal
in class Aggregation
public boolean isProperty()
isProperty
in class Aggregation
protected boolean isInvalid(ParsingContext context)
protected Collection<Object> getCollection(ParsingContext context)
Collection
protected int length(Object value)
Aggregation
length
in class Aggregation
value
- the aggregation valuepublic void setType(Class<?> collectionType)
public Class<? extends Collection<Object>> getType()
public Object createValue(ParsingContext context)
Property
context
- the ParsingContext
public Object getValue(ParsingContext context)
Parser
getValue
in interface Parser
getValue
in interface Property
getValue
in class DelegatingParser
context
- the ParsingContext
public void setValue(ParsingContext context, Object value)
Parser
setValue
in interface Parser
setValue
in interface Property
setValue
in class Aggregation
context
- the ParsingContext
value
- the property valueprotected Collection<Object> createCollection()
public int type()
Property
public int getIterationSize()
Iteration
public void registerLocals(Set<ParserLocal<? extends Object>> locals)
Component
registerLocals
in class Aggregation
locals
- set of local variablespublic boolean hasContent(ParsingContext context)
Parser
hasContent
in interface Parser
hasContent
in class DelegatingParser
context
- the ParsingContext
protected void toParamString(StringBuilder s)
TreeNode
TreeNode.toString()
to append node parameters to the output.toParamString
in class Aggregation
s
- the output to append