org.iscreen.impl.xml
Class PositionContext

java.lang.Object
  extended by org.iscreen.impl.xml.PositionContext

public class PositionContext
extends java.lang.Object

Instances of this class track the position within a "stack" (such as an XML hierarchy) and is used for error messages, giving the user as much information about where the error occurred as possible.

Author:
Shellman, Dan

Field Summary
protected  java.lang.String fileLocation
           
protected  java.util.List nodes
           
 
Constructor Summary
PositionContext(java.lang.String theFileLocation)
          Constructor taking the location of the root "file" location.
 
Method Summary
 java.lang.String getFileLocation()
          Retrieves the root file location.
 java.lang.String getLocation()
          Builds and returns the context path or full location of the "position" this instance represents.
 java.lang.String popNode()
          Removes the top-most node from the context (and all associated attributes of that node).
 void pushAttr(java.lang.String attr, java.lang.String value)
          Pushes an attribute and its value onto the current node (the one at the top of the stack).
 void pushNode(java.lang.String node)
          Pushes a node onto the top of the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileLocation

protected java.lang.String fileLocation

nodes

protected java.util.List nodes
Constructor Detail

PositionContext

public PositionContext(java.lang.String theFileLocation)
Constructor taking the location of the root "file" location.

Parameters:
theFileLocation - The root "file" location.
Method Detail

pushNode

public void pushNode(java.lang.String node)
Pushes a node onto the top of the context. This is the primary method of supplying an additional context.

Parameters:
node - The name of the node.

pushAttr

public void pushAttr(java.lang.String attr,
                     java.lang.String value)
Pushes an attribute and its value onto the current node (the one at the top of the stack). This should only be called after a call to pushNode(). However, it can be called multiple times for a particular node (though the attribute name must be unique, or subsequent calls will override the value).

Parameters:
attr - The name of the attribute.
value - The value of the attribute.

popNode

public java.lang.String popNode()
Removes the top-most node from the context (and all associated attributes of that node).

Returns:
Returns the top-most node (removing it from the stack).

getFileLocation

public java.lang.String getFileLocation()
Retrieves the root file location.

Returns:
Returns the root file location.

getLocation

public java.lang.String getLocation()
Builds and returns the context path or full location of the "position" this instance represents. This method is called to get the location information so that it can be logged.

Returns:
Returns the full context path/location of this context.