org.springframework.beans.factory.parsing
Class ParseState

java.lang.Object
  extended by org.springframework.beans.factory.parsing.ParseState

public final class ParseState
extends java.lang.Object

Simple Stack-based structure for tracking the logical position during a parsing process. entries are added to the stack at each point during the parse phase in a reader-specific manner.

Calling toString() will render a tree-style view of the current logical position in the parse phase. This representation is intended for use in error messages.

Since:
2.0
Author:
Rob Harrop

Nested Class Summary
static interface ParseState.Entry
          Marker interface for entries into the ParseState.
 
Field Summary
private  java.util.Stack state
          Internal Stack storage.
private static char TAB
          Tab character used when rendering the tree-style representation.
 
Constructor Summary
  ParseState()
          Create a new ParseState with an empty Stack.
private ParseState(ParseState other)
          Create a new ParseState whose Stack is a clone of that of the passed in ParseState.
 
Method Summary
 ParseState.Entry peek()
          Return the ParseState.Entry currently at the top of the Stack or null if the Stack is empty.
 void pop()
          Remove an ParseState.Entry from the Stack.
 void push(ParseState.Entry entry)
          Add a new ParseState.Entry to the Stack.
 ParseState snapshot()
          Create a new instance of ParseState which is an independent snapshot of this instance.
 java.lang.String toString()
          Returns a tree-style representation of the current ParseState.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAB

private static final char TAB
Tab character used when rendering the tree-style representation.

See Also:
Constant Field Values

state

private final java.util.Stack state
Internal Stack storage.

Constructor Detail

ParseState

public ParseState()
Create a new ParseState with an empty Stack.


ParseState

private ParseState(ParseState other)
Create a new ParseState whose Stack is a clone of that of the passed in ParseState.

Method Detail

push

public void push(ParseState.Entry entry)
Add a new ParseState.Entry to the Stack.


pop

public void pop()
Remove an ParseState.Entry from the Stack.


peek

public ParseState.Entry peek()
Return the ParseState.Entry currently at the top of the Stack or null if the Stack is empty.


snapshot

public ParseState snapshot()
Create a new instance of ParseState which is an independent snapshot of this instance.


toString

public java.lang.String toString()
Returns a tree-style representation of the current ParseState.

Overrides:
toString in class java.lang.Object