net.sf.mmm.util.pojo.path.base
Class BasicPojoPath

java.lang.Object
  extended by net.sf.mmm.util.pojo.path.base.BasicPojoPath
All Implemented Interfaces:
PojoPath
Direct Known Subclasses:
AbstractPojoPathNavigator.CachingPojoPath

public class BasicPojoPath
extends Object
implements PojoPath

This class represents a PojoPath. It contains the internal logic to validate and parse a PojoPath.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  String function
           
private  Integer index
           
private  String parentPath
           
private  String pojoPath
           
private  String segment
           
 
Fields inherited from interface net.sf.mmm.util.pojo.path.api.PojoPath
SEPARATOR
 
Constructor Summary
BasicPojoPath(String pojoPath)
          The constructor.
 
Method Summary
 String getFunction()
          This method gets the name of the function given by the segment or null if it is no function.
 Integer getIndex()
          This method gets the index given by the segment or null if it is no index.
 String getParentPath()
          This method gets the parent-path of this PojoPath.
 String getPojoPath()
          This method gets the actual PojoPath represented by this object.
 String getSegment()
          This method gets the last segment of this current PojoPath.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pojoPath

private final String pojoPath
See Also:
getPojoPath()

parentPath

private final String parentPath
See Also:
getParentPath()

segment

private final String segment
See Also:
getSegment()

function

private final String function
See Also:
getFunction()

index

private final Integer index
See Also:
getIndex()
Constructor Detail

BasicPojoPath

public BasicPojoPath(String pojoPath)
The constructor.

Parameters:
pojoPath - is the path to represent.
Method Detail

getPojoPath

public String getPojoPath()
This method gets the actual PojoPath represented by this object.

Specified by:
getPojoPath in interface PojoPath
Returns:
the actual PojoPath.

getParentPath

public String getParentPath()
This method gets the parent-path of this PojoPath.
E.g. if this path represents "foo.bar.property" then this method would return "foo.bar".

Specified by:
getParentPath in interface PojoPath
Returns:
the parent-path or null if this is the root-segment.

getSegment

public String getSegment()
This method gets the last segment of this current PojoPath. E.g. if this path represents "foo.bar.property" then this method would return "property".

Specified by:
getSegment in interface PojoPath
Returns:
the last segment.

getFunction

public String getFunction()
This method gets the name of the function given by the segment or null if it is no function.
The function-name identifies a PojoPathFunction that will be used to evaluate the segment.
If a segment starts with the character PojoPathFunction.FUNCTION_NAME_PREFIX ('@'), it is treated as function.

Specified by:
getFunction in interface PojoPath
Returns:
the segment excluding the first character or null if the segment does NOT start with PojoPathFunction.FUNCTION_NAME_PREFIX.

getIndex

public Integer getIndex()
This method gets the index given by the segment or null if it is no index.
An index is an integer that represents the position of an ordered container (array or List).
If a segment starts with a Latin digit, it is treated as index and has to be a valid integer-value. However parsing should be done when this object is constructed and therefore this method should never cause an exception.

Specified by:
getIndex in interface PojoPath
Returns:
the index given by the segment or null if it is no index.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.