Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.project
Class ProjectPath  view ProjectPath download ProjectPath.java

java.lang.Object
  extended byorg.objectstyle.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.


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.
 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.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, 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()

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.


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()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).