net.sf.navel.beans
Class PropertyExpression

java.lang.Object
  extended by net.sf.navel.beans.PropertyExpression

public final class PropertyExpression
extends java.lang.Object

Individual properties that make up the parse tree. All instances that compose and expression are linked together and maintain a reference to the total expression.

Author:
cmdln

Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String expressionToLeaf()
           
 java.lang.String expressionToRoot()
           
 PropertyExpression getChild()
           
 java.lang.String getExpression()
           
 DotNotationExpression getFullExpression()
           
 int getIndex()
           
 PropertyExpression getParent()
           
 java.lang.String getPropertyName()
           
 int hashCode()
           
 boolean hasIndex()
           
 boolean isIndexed()
           
 boolean isLeaf()
           
 boolean isRoot()
           
 java.lang.String toString()
           
 void validateArray(java.lang.Object value)
          When performing an indexed access based on this expression, if the target value is not an array, throw an exception.
 void validateArrayBounds(int length)
          When performing an indexed access based on this expression, if the index value is invalid for the length, throw an exception.
 void validateIndex()
          When performing an indexed access based on this expression, if the index value is invalid, throw an exception.
 void validateInterimForIndexed(java.lang.Object interimValue)
          When performing an indexed access based on this expression, if the target value is null and the expression is indexed, throw an exception.
 void validateListBounds(int size)
          When performing an indexed access based on this expression, if the index value is invalid for the size, throw an exception.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getFullExpression

public DotNotationExpression getFullExpression()
Returns:
The total expression of which this instance is a part.

getExpression

public java.lang.String getExpression()
Returns:
The part of the total expression this instance represents.

isRoot

public boolean isRoot()
Returns:
True if this is the root property in the total expression.

getParent

public PropertyExpression getParent()
Returns:
Null if isRoot() returns true, otherwise, the parent property that needs to be de-referenced to get to this instance.

isLeaf

public boolean isLeaf()
Returns:
True if this is the leaf property in the total expression.

getChild

public PropertyExpression getChild()
Returns:
Null if #isChild() returns true, otherwise, the child property that can be de-reference from this one.

getPropertyName

public java.lang.String getPropertyName()
Returns:
JavaBean complaint property name, the different between this and the result of getExpression() is that the other method preserves the optional bracket operator and this will strip it.

isIndexed

public boolean isIndexed()
Returns:
True if getExpression() contains a bracket operator.

hasIndex

public boolean hasIndex()
Returns:
True if the expression is indexed and has a parseable index value.

getIndex

public int getIndex()
Returns:
-1 if isIndexed() or hasIndex() returns false or the bracket operator is empty, otherwise the number value in the bracket operator.

expressionToLeaf

public java.lang.String expressionToLeaf()
Returns:
The sub-expression to the leaf end, inclusive of this instance.

expressionToRoot

public java.lang.String expressionToRoot()
Returns:
The sub-expression to the root end, inclusive of this instance.

validateIndex

public void validateIndex()
When performing an indexed access based on this expression, if the index value is invalid, throw an exception.


validateListBounds

public void validateListBounds(int size)
When performing an indexed access based on this expression, if the index value is invalid for the size, throw an exception.


validateArray

public void validateArray(java.lang.Object value)
When performing an indexed access based on this expression, if the target value is not an array, throw an exception.


validateArrayBounds

public void validateArrayBounds(int length)
When performing an indexed access based on this expression, if the index value is invalid for the length, throw an exception.


validateInterimForIndexed

public void validateInterimForIndexed(java.lang.Object interimValue)
When performing an indexed access based on this expression, if the target value is null and the expression is indexed, throw an exception.