org.apache.cayenne.project
Class ProjectPath

java.lang.Object
  extended by org.apache.cayenne.project.ProjectPath

public class ProjectPath
extends java.lang.Object

Immutable holder of a selection path within a Cayenne project. Mostly used by various tools (CayenneModeler comes to mind) to navigate Cayenne projects. Contains a number of convenience methods to access path elements.

For instance, given a path Project -> DataMap -> ObjEntity -> ObjAttribute, getObject will return ObjAttribute, getObjectParent- ObjEntity, getRoot- Project.

Author:
Andrei Adamchik

Field Summary
static java.lang.Object[] EMPTY_PATH
           
protected  java.lang.Object[] path
           
 
Constructor Summary
ProjectPath()
           
ProjectPath(java.lang.Object object)
          Constructor for ProjectPath.
ProjectPath(java.lang.Object[] path)
          Constructor for ProjectPath.
 
Method Summary
 ProjectPath appendToPath(java.lang.Object object)
          Returns an instance of the path, expanding this one by appending an object at the end.
 boolean equals(java.lang.Object object)
           
 java.lang.Object firstInstanceOf(java.lang.Class aClass)
          Scans path, looking for the first element that is an instanceof aClass.
 java.lang.Object getObject()
          Returns the last object in the path.
 java.lang.Object getObjectParent()
          Returns an object corresponding to the parent node of the node represented by the path.
 java.lang.Object[] getPath()
           
 java.lang.Object getRoot()
          Returns the root or starting object of the path.
 boolean isEmpty()
           
 ProjectPath subpathOfObject(java.lang.Object object)
          Returns a subpath to the first occurance of an object.
 ProjectPath subpathWithSize(int subpathSize)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_PATH

public static final java.lang.Object[] EMPTY_PATH

path

protected java.lang.Object[] path
Constructor Detail

ProjectPath

public ProjectPath()

ProjectPath

public ProjectPath(java.lang.Object object)
Constructor for ProjectPath.


ProjectPath

public ProjectPath(java.lang.Object[] path)
Constructor for ProjectPath.

Method Detail

getPath

public java.lang.Object[] getPath()

isEmpty

public boolean isEmpty()

firstInstanceOf

public java.lang.Object firstInstanceOf(java.lang.Class aClass)
Scans path, looking for the first element that is an instanceof aClass.


appendToPath

public ProjectPath appendToPath(java.lang.Object object)
Returns an instance of the path, expanding this one by appending an object at the end.


subpathWithSize

public ProjectPath subpathWithSize(int subpathSize)
Since:
1.1

subpathOfObject

public ProjectPath subpathOfObject(java.lang.Object object)
Returns a subpath to the first occurance of an object.

Since:
1.1

getRoot

public java.lang.Object getRoot()
Returns the root or starting object of the path.


getObject

public java.lang.Object getObject()
Returns the last object in the path.


getObjectParent

public java.lang.Object getObjectParent()
Returns an object corresponding to the parent node of the node represented by the path. This is the object next to last object in the path.


toString

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

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object


Copyright © 2001-2006 Apache.org All Rights Reserved.