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.ObjectBase class for the parsing context- marshalling or unmarshaling.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static charMARSHALLINGMarsalling modestatic charUNMARSHALLINGUnmarshalling mode
-
Constructor Summary
Constructors Constructor Description ParsingContext()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidclear()voidcreateHeap(int size)intgetAdjustedFieldPosition(int position)Calculates a field position by adjusting for any applied iterations.java.lang.ObjectgetLocal(int index)abstract chargetMode()Returns the parsing mode.intgetRelativeFieldIndex()Returns the current field index relative to any current iteration.booleanisRepeating()Returns whether a repeating segment or field is being parsed.IterationpopIteration()Pops the lastIterationpushed onto the stack.voidpushIteration(Iteration iteration)Pushes anIterationonto a stack for adjusting field positions and indices.voidsetLocal(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
UNMARSHALLINGorMARSHALLING
-
pushIteration
public void pushIteration(Iteration iteration)
Pushes anIterationonto a stack for adjusting field positions and indices.- Parameters:
iteration- theIterationto push- See Also:
popIteration()
-
popIteration
public Iteration popIteration()
Pops the lastIterationpushed 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)
-
-