public class PrefetchTreeNode extends Object implements Serializable, XMLSerializable
Modifier and Type | Field and Description |
---|---|
protected Collection<PrefetchTreeNode> |
children |
static int |
DISJOINT_BY_ID_PREFETCH_SEMANTICS |
static int |
DISJOINT_PREFETCH_SEMANTICS |
protected String |
ejbqlPathEntityId |
protected String |
entityName |
static int |
JOINT_PREFETCH_SEMANTICS |
protected String |
name |
protected PrefetchTreeNode |
parent |
protected boolean |
phantom |
protected int |
semantics |
static int |
UNDEFINED_SEMANTICS |
Modifier | Constructor and Description |
---|---|
|
PrefetchTreeNode()
Creates a root node of the prefetch tree.
|
protected |
PrefetchTreeNode(PrefetchTreeNode parent,
String name)
Creates a phantom PrefetchTreeNode, initializing it with parent node and
a name of a relationship segment connecting this node with the parent.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(PrefetchTreeNode child) |
PrefetchTreeNode |
addPath(String path)
Adds a "path" with specified semantics to this prefetch node.
|
Collection<PrefetchTreeNode> |
adjacentJointNodes()
Returns a subset of nodes with "joint" semantics that are to be
prefetched in the same query as the current node.
|
PrefetchTreeNode |
cloneJointSubtree()
Returns a clone of subtree that includes all joint children starting from
this node itself and till the first occurrence of non-joint node
|
Collection<PrefetchTreeNode> |
disjointByIdNodes()
Returns a collection of PrefetchTreeNodes with disjoint semantics
|
Collection<PrefetchTreeNode> |
disjointNodes()
Returns a collection of PrefetchTreeNodes with disjoint semantics.
|
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder.
|
protected PrefetchTreeNode |
getChild(String segment) |
Collection<PrefetchTreeNode> |
getChildren()
Returns an unmodifiable collection of children.
|
String |
getEjbqlPathEntityId() |
String |
getEntityName() |
String |
getName() |
PrefetchTreeNode |
getNode(String path)
Looks up an existing node in the tree desribed by the dot-separated path.
|
PrefetchTreeNode |
getParent() |
String |
getPath()
Returns full prefetch path, that is a dot separated String of node names
starting from root and up to and including this node.
|
String |
getPath(PrefetchTreeNode upTillParent) |
PrefetchTreeNode |
getRoot()
Returns the root of the node tree.
|
int |
getSemantics() |
boolean |
hasChildren() |
boolean |
isDisjointByIdPrefetch() |
boolean |
isDisjointPrefetch() |
boolean |
isJointPrefetch() |
boolean |
isPhantom() |
Collection<PrefetchTreeNode> |
jointNodes()
Returns a collection of PrefetchTreeNodes in this tree with joint
semantics.
|
void |
merge(PrefetchTreeNode node)
Merges
PrefetchTreeNode into the current prefetch tree, cloning
the nodes added to this tree. |
Collection<PrefetchTreeNode> |
nonPhantomNodes()
Returns a collection of PrefetchTreeNodes that are not phantoms.
|
void |
removeChild(PrefetchTreeNode child) |
protected void |
removeChild(String segment) |
void |
removePath(String path)
Removes or makes phantom a node defined by this path.
|
void |
setEjbqlPathEntityId(String ejbqlPathEntityId) |
void |
setEntityName(String entityName) |
void |
setPhantom(boolean phantom) |
void |
setSemantics(int semantics) |
void |
traverse(PrefetchProcessor processor)
Traverses the tree depth-first, invoking callback methods of the
processor when passing through the nodes.
|
static PrefetchTreeNode |
withPath(String path,
int semantics)
Creates and returns a prefetch tree spanning a single path.
|
public static final int UNDEFINED_SEMANTICS
public static final int JOINT_PREFETCH_SEMANTICS
public static final int DISJOINT_PREFETCH_SEMANTICS
public static final int DISJOINT_BY_ID_PREFETCH_SEMANTICS
protected String name
protected boolean phantom
protected int semantics
protected String ejbqlPathEntityId
protected String entityName
protected transient PrefetchTreeNode parent
protected Collection<PrefetchTreeNode> children
public PrefetchTreeNode()
protected PrefetchTreeNode(PrefetchTreeNode parent, String name)
public static PrefetchTreeNode withPath(String path, int semantics)
public void encodeAsXML(XMLEncoder encoder)
XMLSerializable
encodeAsXML
in interface XMLSerializable
public PrefetchTreeNode getRoot()
public String getPath()
public String getPath(PrefetchTreeNode upTillParent)
public Collection<PrefetchTreeNode> adjacentJointNodes()
public Collection<PrefetchTreeNode> jointNodes()
public Collection<PrefetchTreeNode> disjointNodes()
public Collection<PrefetchTreeNode> disjointByIdNodes()
public Collection<PrefetchTreeNode> nonPhantomNodes()
public PrefetchTreeNode cloneJointSubtree()
public void traverse(PrefetchProcessor processor)
public PrefetchTreeNode getNode(String path)
public PrefetchTreeNode addPath(String path)
public void merge(PrefetchTreeNode node)
PrefetchTreeNode
into the current prefetch tree, cloning
the nodes added to this tree. Merged nodes semantics (if defined) and
non-phantom status are applied to the nodes of this tree.node
- a root node of a tree to merge into this tree. The path of the
merged node within the resulting tree is determined from its
name.public void removePath(String path)
public void addChild(PrefetchTreeNode child)
public void removeChild(PrefetchTreeNode child)
protected void removeChild(String segment)
protected PrefetchTreeNode getChild(String segment)
public PrefetchTreeNode getParent()
public Collection<PrefetchTreeNode> getChildren()
public boolean hasChildren()
public String getName()
public boolean isPhantom()
public void setPhantom(boolean phantom)
public int getSemantics()
public void setSemantics(int semantics)
public boolean isJointPrefetch()
public boolean isDisjointPrefetch()
public boolean isDisjointByIdPrefetch()
public String getEjbqlPathEntityId()
public void setEjbqlPathEntityId(String ejbqlPathEntityId)
public String getEntityName()
public void setEntityName(String entityName)
Copyright © 2001–2015 Apache Cayenne. All rights reserved.