Package org.beanio.internal.parser
Class ParsingContext
- java.lang.Object
-
- org.beanio.internal.parser.ParsingContext
-
- Direct Known Subclasses:
MarshallingContext
,UnmarshallingContext
public abstract class ParsingContext extends java.lang.Object
Base class for the parsing context- marshalling or unmarshaling.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static char
MARSHALLING
Marsalling modestatic char
UNMARSHALLING
Unmarshalling mode
-
Constructor Summary
Constructors Constructor Description ParsingContext()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clear()
void
createHeap(int size)
int
getAdjustedFieldPosition(int position)
Calculates a field position by adjusting for any applied iterations.java.lang.Object
getLocal(int index)
abstract char
getMode()
Returns the parsing mode.int
getRelativeFieldIndex()
Returns the current field index relative to any current iteration.boolean
isRepeating()
Returns whether a repeating segment or field is being parsed.Iteration
popIteration()
Pops the lastIteration
pushed onto the stack.void
pushIteration(Iteration iteration)
Pushes anIteration
onto a stack for adjusting field positions and indices.void
setLocal(int index, java.lang.Object obj)
-
-
-
Field Detail
-
UNMARSHALLING
public static final char UNMARSHALLING
Unmarshalling mode- See Also:
- Constant Field Values
-
MARSHALLING
public static final char MARSHALLING
Marsalling mode- See Also:
- Constant Field Values
-
-
Method Detail
-
clear
protected void clear()
-
getMode
public abstract char getMode()
Returns the parsing mode.- Returns:
- either
UNMARSHALLING
orMARSHALLING
-
pushIteration
public void pushIteration(Iteration iteration)
Pushes anIteration
onto a stack for adjusting field positions and indices.- Parameters:
iteration
- theIteration
to push- See Also:
popIteration()
-
popIteration
public Iteration popIteration()
Pops the lastIteration
pushed onto the stack.- See Also:
pushIteration(Iteration)
-
getAdjustedFieldPosition
public final int getAdjustedFieldPosition(int position)
Calculates a field position by adjusting for any applied iterations.- Parameters:
position
- the field position to adjust (i.e. the position of the first occurrence of the field)- Returns:
- the adjusted field position
-
getRelativeFieldIndex
public final int getRelativeFieldIndex()
Returns the current field index relative to any current iteration.- Returns:
- the field index
-
isRepeating
public final boolean isRepeating()
Returns whether a repeating segment or field is being parsed.- Returns:
- true if repeating, false otherwise
-
createHeap
public final void createHeap(int size)
-
getLocal
public final java.lang.Object getLocal(int index)
-
setLocal
public final void setLocal(int index, java.lang.Object obj)
-
-