public class Group extends ParserComponent implements Selector
| Constructor and Description |
|---|
Group()
Constructs a new Group.
|
| 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.
|
int |
getCount(ParsingContext context)
Returns the number of times this component was matched within the current
iteration of its parent component.
|
protected String |
getKey(String namespace,
String name)
Returns a Map key for accessing state information for this Node.
|
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).
|
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. |
int |
getSize()
Returns the size of a single occurrence of this element, which is used to offset
field positions for repeating segments and fields.
|
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.
|
boolean |
isIdentifier()
Returns whether this parser or any descendant of this parser is used to identify
a record during unmarshalling.
|
boolean |
isMaxOccursReached(ParsingContext context)
Tests if the max occurs has been reached for this node.
|
boolean |
isOptional()
Returns whether this node must exist during unmarshalling.
|
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.
|
boolean |
marshal(MarshallingContext context)
Marshals a record.
|
Selector |
matchAny(UnmarshallingContext context)
Finds a parser that matches the input record.
|
boolean |
matches(UnmarshallingContext context)
Returns whether this parser and its children match a record
being unmarshalled.
|
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<?>> 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 |
setCount(ParsingContext context,
int count)
Sets the number of times this component was matched within the current
iteration of its parent component.
|
void |
setMaxOccurs(int maxOccurs) |
void |
setMinOccurs(int minOccurs) |
void |
setOrder(int order) |
void |
setProperty(Property property) |
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. |
boolean |
unmarshal(UnmarshallingContext context)
Unmarshals a record.
|
void |
updateState(ParsingContext context,
String namespace,
Map<String,Object> state)
Updates a Map with the current state of the Marshaller.
|
add, clone, find, getChildren, getFirst, getName, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferencesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic boolean marshal(MarshallingContext context) throws IOException
Parsermarshal in interface Parsercontext - the MarshallingContextIOException - if an I/O error occurspublic void skip(UnmarshallingContext context)
Selectorskip in interface Selectorcontext - the UnmarshallingContextpublic boolean unmarshal(UnmarshallingContext context)
Parserunmarshal in interface Parsercontext - the UnmarshallingContextpublic Selector matchAny(UnmarshallingContext context)
SelectorSelector.matchNext(UnmarshallingContext) returns null, in order to differentiate
between unexpected and unidentified record types.matchAny in interface Selectorcontext - the UnmarshallingContextSelectorpublic Selector matchNext(UnmarshallingContext context)
SelectormatchNext in interface Selectorcontext - the UnmarshallingContextSelector for unmarshalling the recordpublic Selector matchNext(MarshallingContext context)
SelectormatchNext in interface Selectorcontext - the MarshallingContextSelector for marshalling the bean objectpublic void reset(ParsingContext context)
Selectorreset in interface Selectorcontext - the ParsingContextpublic Selector close(ParsingContext context)
Selectorclose in interface Selectorcontext - the ParsingContextpublic boolean matches(UnmarshallingContext context)
Parsermatches in interface Parsercontext - the UnmarshallingContextpublic boolean isMaxOccursReached(ParsingContext context)
isMaxOccursReached in interface Selectorcontext - the ParsingContextpublic int getSize()
ParserThe concept of size is dependent on the stream format. The size of an element in a fixed length stream format is determined by the length of the element in characters, while other stream formats calculate size based on the number of fields. Some stream formats, such as XML, may ignore size settings.
public void updateState(ParsingContext context, String namespace, Map<String,Object> state)
updateState in interface Selectornamespace - a String to prefix all state keys withstate - the Map to update with the latest statecontext - the ParsingContextpublic void restoreState(ParsingContext context, String namespace, Map<String,Object> state)
restoreState in interface Selectornamespace - a String to prefix all state keys withstate - the Map containing the state to restorecontext - the ParsingContextprotected String getKey(String namespace, String name)
namespace - the assigned namespace for the keyname - the state information to accesspublic boolean isRecordGroup()
SelectorisRecordGroup in interface Selectorpublic int getMinOccurs()
SelectorgetMinOccurs in interface Selectorpublic void setMinOccurs(int minOccurs)
public int getMaxOccurs()
SelectorgetMaxOccurs in interface Selectorpublic void setMaxOccurs(int maxOccurs)
public int getOrder()
Selectorpublic void setOrder(int order)
public int getCount(ParsingContext context)
SelectorgetCount in interface Selectorcontext - the ParsingContextpublic void setCount(ParsingContext context, int count)
SelectorsetCount in interface Selectorcontext - the ParsingContextcount - the new match countpublic void clearValue(ParsingContext context)
ParserclearValue in interface Parsercontext - the ParsingContextpublic void setValue(ParsingContext context, Object value)
ParsersetValue in interface Parsercontext - the ParsingContextvalue - the property valuepublic Object getValue(ParsingContext context)
ParsergetValue in interface Parsercontext - the ParsingContextpublic Property getProperty()
SelectorProperty mapped to this component, or null if there is
no property mapping.getProperty in interface SelectorProperty mapped to this componentpublic void setProperty(Property property)
public boolean isOptional()
ParserisOptional in interface Parserpublic boolean isIdentifier()
ParserisIdentifier in interface Parserpublic boolean hasContent(ParsingContext context)
ParserhasContent in interface Parsercontext - the ParsingContextpublic void registerLocals(Set<ParserLocal<?>> locals)
ComponentregisterLocals in class Componentlocals - set of local variablesprotected boolean isSupportedChild(Component child)
TreeNodeTreeNode.add(TreeNode).isSupportedChild in class ParserComponentchild - the node to testprotected void toParamString(StringBuilder s)
TreeNodeTreeNode.toString() to append node parameters to the output.toParamString in class TreeNode<Component>s - the output to append