|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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.MapParser
public class MapParser
A Parser
component for aggregating inline Map
objects.
For example: key1,field1,key2,field2.
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 | |
---|---|
MapParser()
Constructs a new MapParser. |
Method Summary | |
---|---|
void |
clearValue(ParsingContext context)
Clears the current property value. |
protected Map<Object,Object> |
createMap()
|
Object |
createValue(ParsingContext context)
Creates the property value and returns it. |
boolean |
defines(Object value)
|
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. |
Property |
getKey()
|
protected Map<Object,Object> |
getMap(ParsingContext context)
Returns the map value being parsed. |
Class<? extends Map<Object,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. |
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 |
setKey(Property key)
|
void |
setType(Class<?> mapType)
Sets the concrete Map type. |
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 MapParser()
Method Detail |
---|
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
public boolean marshal(MarshallingContext context) throws IOException
Parser
marshal
in interface Parser
marshal
in class DelegatingParser
context
- the MarshallingContext
IOException
- if an I/O error occurspublic boolean unmarshal(UnmarshallingContext context)
Parser
unmarshal
in interface Parser
unmarshal
in class DelegatingParser
context
- the UnmarshallingContext
public boolean isProperty()
isProperty
in class Aggregation
public Class<? extends Map<Object,Object>> getType()
public void setType(Class<?> mapType)
Map
type.
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 DelegatingParser
context
- the ParsingContext
value
- the property valueprotected Map<Object,Object> createMap()
protected Map<Object,Object> getMap(ParsingContext context)
Map
public int getIterationIndex(ParsingContext context)
Iteration
public int getIterationSize()
Iteration
public int type()
Property
Property.SIMPLE
, Property.COMPLEX
, Property.AGGREGATION_ARRAY
, Property.COLLECTION
,
Property.AGGREGATION_COLLECTION
, or Property.MAP
public void registerLocals(Set<ParserLocal<? extends Object>> locals)
Component
registerLocals
in class Component
locals
- set of local variablespublic boolean hasContent(ParsingContext context)
Parser
hasContent
in interface Parser
hasContent
in class DelegatingParser
context
- the ParsingContext
public Property getKey()
public void setKey(Property key)
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
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |