|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.generator.source.SourcePath
public final class SourcePath
Methods for traversing a source tree.
Method Summary | |
---|---|
static SourceElement |
getElement(SourceElement sourceElement,
String path,
boolean acceptEmpty)
Gets a single source element which can be reached from the start element by a given path. |
static List<SourceElement> |
getElements(SourceElement sourceElement,
String path)
Gets the elements which can be reached from the start element by a given path. |
static List<SourceElement> |
getElementsFromRoot(SourceElement rootElement,
String path)
Gets the elements which can be reached from the root element by a given path. |
static List<SourceElement> |
getFollowing(SourceElement sourceElement,
String name)
Returns all the following elements after this element with the given name. |
static String |
getPathAsString(SourceElement sourceElement)
Returns the path from the root element to the source element. |
static List<SourceElement> |
getPreceding(SourceElement sourceElement,
String name)
Returns all the preceding elements before this element with the given name. |
static boolean |
hasChild(SourceElement sourceElement,
String name)
Returns whether children with the given name exist. |
static boolean |
hasFollowing(SourceElement sourceElement)
Returns whether a following element exists as a child of the parent of this element. |
static boolean |
hasFollowingSibling(SourceElement sourceElement)
Returns whether a following element exists as a child of the parent of this element, which has the same name as this source element. |
static boolean |
hasPreceding(SourceElement sourceElement)
Returns whether an preceding exists as a child of the parent of this element. |
static boolean |
hasPrecedingSibling(SourceElement sourceElement)
Returns whether an preceding exists as a child of the parent of this element, which has the same name as this source element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean hasChild(SourceElement sourceElement, String name)
sourceElement
- the start element, not null.name
- the name of the child element, not null.
NullPointerException
- if name is null.public static boolean hasFollowing(SourceElement sourceElement)
sourceElement
- the start element, not null.
public static boolean hasPreceding(SourceElement sourceElement)
sourceElement
- the start element, not null.
public static boolean hasFollowingSibling(SourceElement sourceElement)
sourceElement
- the start element, not null.
public static boolean hasPrecedingSibling(SourceElement sourceElement)
sourceElement
- the start element, not null.
public static List<SourceElement> getPreceding(SourceElement sourceElement, String name)
sourceElement
- the start element, not null.name
- the name of the preceding elements to select,
or null to select all preceding elements.
public static List<SourceElement> getFollowing(SourceElement sourceElement, String name)
sourceElement
- the start element, not null.name
- the name of the following elements to select,
or null to select all following elements.
public static List<SourceElement> getElements(SourceElement sourceElement, String path)
sourceElement
- the start element, not null.path
- the path to use, not null.
public static List<SourceElement> getElementsFromRoot(SourceElement rootElement, String path)
rootElement
- the root element of the source tree, not null.path
- the path to use, null selects the root element.
public static SourceElement getElement(SourceElement sourceElement, String path, boolean acceptEmpty) throws GeneratorException
sourceElement
- the start element, not null.path
- the path to use, not null.acceptEmpty
- whether no match is an error(acceptEmpty=false)
or not (acceptEmpty=true)
GeneratorException
- if more than one source element matches,
or if no source element matches and acceptEmpty=falsepublic static String getPathAsString(SourceElement sourceElement) throws GeneratorException
sourceElement
- the element to output, not null.
GeneratorException
- if the parent chain contains a closed loop.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |