|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sonyericsson.hudson.plugins.metadata.model.values.TreeStructureUtil
public abstract class TreeStructureUtil
Utility methods for easier creation of tree structures of values.
Method Summary | ||
---|---|---|
static boolean |
addValue(MetadataParent root,
AbstractMetadataValue value,
boolean generated,
String... parentPath)
Adds a value with the specified path to the root. |
|
static boolean |
addValue(MetadataParent root,
AbstractMetadataValue value,
String... parentPath)
Adds a value with the specified path to the root. |
|
static boolean |
addValue(MetadataParent root,
Date value,
String description,
boolean exposedToEnvironment,
String... path)
Adds a DateMetadataValue to the root node with the specified path. |
|
static boolean |
addValue(MetadataParent root,
String value,
String description,
boolean generated,
boolean exposedToEnvironment,
String... path)
Adds a StringMetadataValue to the root node with the specified path. |
|
static boolean |
addValue(MetadataParent root,
String value,
String description,
String... path)
Adds a StringMetadataValue to the root node with the specified path. |
|
static TreeNodeMetadataValue |
createPath(AbstractMetadataValue leaf,
boolean generated,
String... parentPath)
Creates a tree structured path with the provided leaf at the end. |
|
static TreeNodeMetadataValue |
createPath(AbstractMetadataValue leaf,
String... parentPath)
Creates a tree structured path with the provided leaf at the end. |
|
static TreeNodeMetadataValue |
createPath(Date value,
String description,
boolean exposedToEnvironment,
String... path)
Creates a path where the last element is a string with the provided value and description. |
|
static TreeNodeMetadataValue |
createPath(String value,
String description,
boolean generated,
boolean exposedToEnvironment,
String... path)
Creates a path where the last element is a string with the provided value and description. |
|
static TreeNodeMetadataValue |
createPath(String value,
String description,
String... path)
Creates a path where the last element is a string with the provided value and description. |
|
static TreeNodeMetadataValue[] |
createTreePath(String description,
boolean generated,
String... path)
Creates a straight tree-path. |
|
static TreeNodeMetadataValue[] |
createTreePath(String description,
String... path)
Creates a straight tree-path. |
|
static
|
findLeaves(Collection<T> collection,
Collection<T> newCollection)
Adds all the leaves in the collection to the newCollection. |
|
static MetadataContainer |
getContainer(Metadata metadata)
Find the first MetadataContainer that is an ancestor to the given Metadata. |
|
static
|
getLeaf(Collection<T> collection,
String... path)
Returns the leaf with the given path. |
|
static
|
getLeaf(MetadataParent<T> root,
String... path)
Returns the leaf with the given path. |
|
static
|
getPath(Collection<T> collection,
String... path)
Returns the node with the given path. |
|
static
|
getPath(MetadataParent<T> root,
String... path)
Returns the node with the given path. |
|
static String |
prettyPrint(Collection<MetadataValue> values,
String tabs)
Prints the values and their children if any into a structured string. |
|
static String |
prettyPrint(MetadataValue value,
String tabs)
Prints the value and it's child if any into a structured string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean addValue(MetadataParent root, String value, String description, String... path)
StringMetadataValue
to the root node with the specified path.
root
- the root to add the tree to.value
- the string value of the leaf node.description
- the description of the leaf node.path
- the path to the leaf from the root.
public static boolean addValue(MetadataParent root, String value, String description, boolean generated, boolean exposedToEnvironment, String... path)
StringMetadataValue
to the root node with the specified path.
root
- the root to add the tree to.value
- the string value of the leaf node.description
- the description of the leaf node.generated
- what the value's
MetadataValue.isGenerated()
should be.exposedToEnvironment
- if this value should be exposed to the build as an
environment variable.path
- the path to the leaf from the root.
public static boolean addValue(MetadataParent root, Date value, String description, boolean exposedToEnvironment, String... path)
DateMetadataValue
to the root node with the specified path.
root
- the root to add the tree to.value
- the date value of the leaf node.description
- the description of the leaf node.exposedToEnvironment
- if this value should be exposed to the build as an
environment variable.path
- the path to the leaf from the root.
public static boolean addValue(MetadataParent root, AbstractMetadataValue value, String... parentPath)
root
- the root to add the tree to.value
- the value of the leaf.parentPath
- the path of the parent of the leaf from the root.
public static boolean addValue(MetadataParent root, AbstractMetadataValue value, boolean generated, String... parentPath)
root
- the root to add the tree to.value
- the value of the leaf.generated
- the parentPath should be marked as generated or not.parentPath
- the path of the parent of the leaf from the root.
public static TreeNodeMetadataValue createPath(String value, String description, String... path)
value
- the valuedescription
- the descriptionpath
- the full path to the leaf.
public static TreeNodeMetadataValue createPath(String value, String description, boolean generated, boolean exposedToEnvironment, String... path)
value
- the valuedescription
- the descriptiongenerated
- what the value's
MetadataValue.isGenerated()
should be.exposedToEnvironment
- if this value should be exposed to the build as an
environment variable.path
- the full path to the leaf.
public static TreeNodeMetadataValue createPath(Date value, String description, boolean exposedToEnvironment, String... path)
value
- the valuedescription
- the descriptionexposedToEnvironment
- if this value should be exposed to the build as an
environment variable.path
- the full path to the leaf.
public static TreeNodeMetadataValue createPath(AbstractMetadataValue leaf, String... parentPath)
MetadataValue.isGenerated()
will be true.
leaf
- the leaf to put in the end.parentPath
- the path to the leaf.
public static TreeNodeMetadataValue createPath(AbstractMetadataValue leaf, boolean generated, String... parentPath)
leaf
- the leaf to put in the end.generated
- what the value's
MetadataValue.isGenerated()
should be.parentPath
- the path to the leaf.
public static TreeNodeMetadataValue[] createTreePath(String description, String... path)
MetadataValue.isGenerated()
will be true.
description
- the description of the root.path
- the path to create.
public static TreeNodeMetadataValue[] createTreePath(String description, boolean generated, String... path)
description
- the description of the root.generated
- what the value's
MetadataValue.isGenerated()
should be.path
- the path to create.
public static <T extends Metadata> T getPath(MetadataParent<T> root, String... path)
T
- The type of metadata.root
- the root to start from when searching for the node with the given path.path
- the path for which a node should be returned.
public static <T extends Metadata> T getPath(Collection<T> collection, String... path)
T
- The type of metadata.collection
- a collection of nodes to use as root nodes when searching for the node with the given path.path
- the path for which a node should be returned.
public static <T extends Metadata> T getLeaf(MetadataParent<T> root, String... path)
T
- The type of metadata.root
- the root to start from when searching for the leaf node with the given path.path
- the path for which a leaf node should be returned.
public static <T extends Metadata> T getLeaf(Collection<T> collection, String... path)
T
- The type of metadata.collection
- the collection to start from.path
- the path for which a leaf node should be returned.
public static <T extends Metadata> void findLeaves(Collection<T> collection, Collection<T> newCollection)
T
- the type of Metadata.collection
- the Collection to find the leaves in.newCollection
- the result.public static String prettyPrint(MetadataValue value, String tabs)
value
- the value to printtabs
- the current level
public static String prettyPrint(Collection<MetadataValue> values, String tabs)
values
- the values to printtabs
- the current level.
public static MetadataContainer getContainer(Metadata metadata)
metadata
- the Metadata to find a MetadataContainer for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |