public abstract class RecordAggregation extends DelegatingParser implements Selector, Property
Modifier and Type | Field and Description |
---|---|
protected boolean |
lazy |
protected ParserLocal<Object> |
value |
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE
Constructor and Description |
---|
RecordAggregation()
Constructs a new RecordAggregation.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue(ParsingContext context)
Clears the current property value.
|
Selector |
close(ParsingContext context)
Checks for any unsatisfied components before the stream is closed.
|
protected Object |
createAggregationType() |
Object |
createValue(ParsingContext context)
Creates the property value and returns it.
|
boolean |
defines(Object value) |
PropertyAccessor |
getAccessor() |
int |
getCount(ParsingContext context)
Returns the number of times this component was matched within the current
iteration of its parent component.
|
int |
getMaxOccurs()
Returns the maximum number of occurrences of this component (within the context
of its parent).
|
int |
getMinOccurs()
Returns the minimum number of occurrences of this component (within the context
of its parent).
|
Object |
getNullValue() |
int |
getOrder()
Returns the order of this component (within the context of its parent).
|
Property |
getProperty()
Returns the
Property mapped to this component, or null if there is
no property mapping. |
Selector |
getSelector()
Returns the child selector.
|
Class<?> |
getType() |
Object |
getValue(ParsingContext context)
Returns the unmarshalled property value.
|
boolean |
isIdentifier()
Returns whether this parser or any descendant of this parser is used to identify
a record during unmarshalling.
|
boolean |
isLazy() |
boolean |
isMaxOccursReached(ParsingContext context)
Returns whether this component has reached its maximum occurrences.
|
boolean |
isRecordGroup()
Returns whether this component is a record group.
|
protected boolean |
isSupportedChild(Component child)
Returns whether a node is a supported child of this node.
|
Selector |
matchAny(UnmarshallingContext context)
Finds a parser that matches the input record.
|
Selector |
matchNext(MarshallingContext context)
Finds a parser for marshalling a bean object.
|
Selector |
matchNext(UnmarshallingContext context)
Finds a parser for unmarshalling a record based on the current state of the stream.
|
void |
registerLocals(Set<ParserLocal<? extends Object>> locals)
Called by a stream to register variables stored in the parsing context.
|
void |
reset(ParsingContext context)
Resets the component count of this Selector's children.
|
void |
restoreState(ParsingContext context,
String namespace,
Map<String,Object> state)
Restores a Map of previously stored state information.
|
void |
setAccessor(PropertyAccessor accessor) |
void |
setCount(ParsingContext context,
int count)
Sets the number of times this component was matched within the current
iteration of its parent component.
|
void |
setIdentifier(boolean identifier) |
void |
setLazy(boolean lazy) |
void |
setType(Class<?> type)
Sets the collection type.
|
void |
setValue(ParsingContext context,
Object value)
Sets the property value for marshaling.
|
void |
skip(UnmarshallingContext context)
Skips a record or group of records.
|
protected void |
toParamString(StringBuilder s)
Called by
TreeNode.toString() to append node parameters to the output. |
void |
updateState(ParsingContext context,
String namespace,
Map<String,Object> state)
Updates a Map with the current state of the Writer to allow for
restoration at a later time.
|
getParser, getSize, hasContent, isOptional, marshal, matches, unmarshal
add, clone, find, getChildren, getFirst, getName, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferences
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, getSize, hasContent, isOptional, marshal, matches, unmarshal
forEach, spliterator
protected ParserLocal<Object> value
protected boolean lazy
public void setType(Class<?> type)
setType
in interface Property
type
- Collection
class typepublic Object createValue(ParsingContext context)
Property
createValue
in interface Property
context
- the ParsingContext
public Object getNullValue()
protected Object createAggregationType()
public Object getValue(ParsingContext context)
Parser
getValue
in interface Parser
getValue
in interface Property
getValue
in class DelegatingParser
context
- the ParsingContext
public void clearValue(ParsingContext context)
Parser
clearValue
in interface Parser
clearValue
in interface Property
clearValue
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 DelegatingParser
context
- the ParsingContext
value
- the property valuepublic Property getProperty()
Selector
Property
mapped to this component, or null if there is
no property mapping.getProperty
in interface Selector
Property
mapped to this componentpublic Selector matchNext(UnmarshallingContext context)
Selector
matchNext
in interface Selector
context
- the UnmarshallingContext
Selector
for unmarshalling the recordpublic Selector matchAny(UnmarshallingContext context)
Selector
Selector.matchNext(UnmarshallingContext)
returns null, in order to differentiate
between unexpected and unidentified record types.matchAny
in interface Selector
context
- the UnmarshallingContext
Selector
public Selector matchNext(MarshallingContext context)
Selector
matchNext
in interface Selector
context
- the MarshallingContext
Selector
for marshalling the bean objectpublic Selector close(ParsingContext context)
Selector
close
in interface Selector
context
- the ParsingContext
public void reset(ParsingContext context)
Selector
reset
in interface Selector
context
- the ParsingContext
public int getCount(ParsingContext context)
Selector
getCount
in interface Selector
context
- the ParsingContext
public void setCount(ParsingContext context, int count)
Selector
setCount
in interface Selector
context
- the ParsingContext
count
- the new match countpublic int getOrder()
Selector
public boolean isMaxOccursReached(ParsingContext context)
Selector
isMaxOccursReached
in interface Selector
context
- the ParsingContext
public void updateState(ParsingContext context, String namespace, Map<String,Object> state)
Selector
updateState
in interface Selector
context
- the ParsingContext
namespace
- a String to prefix all state keys withstate
- the Map to update with the latest statepublic void restoreState(ParsingContext context, String namespace, Map<String,Object> state) throws IllegalStateException
Selector
restoreState
in interface Selector
context
- the ParsingContext
namespace
- a String to prefix all state keys withstate
- the Map containing the state to restoreIllegalStateException
- if the Map is missing any state informationpublic int getMinOccurs()
Selector
getMinOccurs
in interface Selector
public int getMaxOccurs()
Selector
getMaxOccurs
in interface Selector
public boolean isLazy()
public void setLazy(boolean lazy)
protected boolean isSupportedChild(Component child)
TreeNode
TreeNode.add(TreeNode)
.isSupportedChild
in class ParserComponent
child
- the node to testpublic PropertyAccessor getAccessor()
getAccessor
in interface Property
public void setAccessor(PropertyAccessor accessor)
setAccessor
in interface Property
public void setIdentifier(boolean identifier)
setIdentifier
in interface Property
public boolean isIdentifier()
Parser
isIdentifier
in interface Parser
isIdentifier
in interface Property
isIdentifier
in class DelegatingParser
public void registerLocals(Set<ParserLocal<? extends Object>> locals)
Component
registerLocals
in class Component
locals
- set of local variablespublic void skip(UnmarshallingContext context)
Selector
skip
in interface Selector
context
- the UnmarshallingContext
public boolean isRecordGroup()
Selector
isRecordGroup
in interface Selector
protected void toParamString(StringBuilder s)
TreeNode
TreeNode.toString()
to append node parameters to the output.toParamString
in class TreeNode<Component>
s
- the output to append