Package org.beanio.internal.parser
Interface Parser
-
- All Known Subinterfaces:
Selector
- All Known Implementing Classes:
Aggregation
,ArrayParser
,CollectionParser
,DelegatingParser
,Field
,Group
,JsonWrapper
,MapParser
,ParserComponent
,Record
,RecordAggregation
,RecordArray
,RecordCollection
,RecordMap
,Segment
,XmlSelectorWrapper
,XmlWrapper
public interface Parser
AParser
is used marshal and unmarshal record components.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearValue(ParsingContext context)
Clears the current property value.java.lang.String
getName()
Returns the name of this parser component.int
getSize()
Returns the size of a single occurrence of this element, which is used to offset field positions for repeating segments and fields.java.lang.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
isOptional()
Returns whether this node must exist during unmarshalling.boolean
marshal(MarshallingContext context)
Marshals a record.boolean
matches(UnmarshallingContext context)
Returns whether this parser and its children match a record being unmarshalled.void
setValue(ParsingContext context, java.lang.Object value)
Sets the property value for marshaling.boolean
unmarshal(UnmarshallingContext context)
Unmarshals a record.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of this parser component.- Returns:
- the parser component name
-
matches
boolean matches(UnmarshallingContext context)
Returns whether this parser and its children match a record being unmarshalled.- Parameters:
context
- theUnmarshallingContext
- Returns:
- true if matched, false otherwise
-
unmarshal
boolean unmarshal(UnmarshallingContext context) throws AbortRecordUnmarshalligException
Unmarshals a record.- Parameters:
context
- theUnmarshallingContext
- Returns:
true
if this component was present in the unmarshalled record, orfalse
otherwise- Throws:
AbortRecordUnmarshalligException
-
marshal
boolean marshal(MarshallingContext context) throws java.io.IOException
Marshals a record.- Parameters:
context
- theMarshallingContext
- Returns:
- whether a value was marshalled
- Throws:
java.io.IOException
- if an I/O error occurs
-
hasContent
boolean hasContent(ParsingContext context)
Returns whether this parser or any of its descendant have content for marshalling.- Parameters:
context
- theParsingContext
- Returns:
- true if there is content for marshalling, false otherwise
-
clearValue
void clearValue(ParsingContext context)
Clears the current property value.- Parameters:
context
- theParsingContext
-
setValue
void setValue(ParsingContext context, java.lang.Object value)
Sets the property value for marshaling.- Parameters:
context
- theParsingContext
value
- the property value
-
getValue
java.lang.Object getValue(ParsingContext context)
Returns the unmarshalled property value.- Parameters:
context
- theParsingContext
- Returns:
- the property value
-
getSize
int getSize()
Returns the size of a single occurrence of this element, which is used to offset field positions for repeating segments and fields.The 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.
- Returns:
- the size of this parser element
-
isIdentifier
boolean isIdentifier()
Returns whether this parser or any descendant of this parser is used to identify a record during unmarshalling.- Returns:
- true if this parser or any descendant is used to identify a record
-
isOptional
boolean isOptional()
Returns whether this node must exist during unmarshalling.- Returns:
- true if this node is optional during unmarshalling, false otherwise
-
-