Class Expansion
java.lang.Object
com.atlassian.bamboo.rest.model.expansion.Expansion
Represents an expansion tree. An expansion has the initial property to expand
node
and any sub properties
will get collected in the subExpansions
If its the root node it will only have children e.g. "a.b,c.d" will become an Expansion with a root node ("ROOT"), with two sub nodes "a" and "c"
If its a sub node, it will have the name of the sub node, and its children. e.g. "a.c,a.b" will have "a" as the node and subExpansion of "c" and "b"
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubExpansion
(@Nullable Expansion expansion) Adds a single sub expansion to this expansion.void
addSubExpansions
(@Nullable Collection<Expansion> expansions) Adds sub expansions to this expansion.boolean
Check if the current property can be expandedboolean
Check if the given property is a sub node of the current propertyboolean
@NotNull Expansion
getExpansion
(@NotNull String name) Get expansion at a specific sub node.@NotNull String
getName()
@NotNull Expansion
getSubExpansion
(@NotNull String name) Get expansion at a specific sub node.@NotNull Collection<Expansion>
int
hashCode()
boolean
isRoot()
static @NotNull Expansion
Takes in expansion arguments and parses/splits/merges them into an expansion tree.Split an expansion string into its first node and rest.toString()
Flattens the tree into a string format
-
Field Details
-
ROOT_NODE
- See Also:
-
SELF
-
-
Method Details
-
parse
Takes in expansion arguments and parses/splits/merges them into an expansion tree. Tree has a root node. Sub nodes may be empty representing no requested expands- Parameters:
string
- to parse- Returns:
- expansion with
-
getName
- Returns:
- The name of the current node of expansion
-
isRoot
public boolean isRoot()- Returns:
- true if this node is the root node
-
getSubExpansions
- Returns:
- a collection of all sub expansions of this node
-
addSubExpansions
Adds sub expansions to this expansion. If expansions with similar node names exist, it will me merged with existing nodes- Parameters:
expansions
- to add
-
addSubExpansion
Adds a single sub expansion to this expansion. If expansions with similar node names exist, it will me merged with existing nodes- Parameters:
expansion
- to add
-
canExpand
Check if the given property is a sub node of the current property- Parameters:
name
- to check- Returns:
- true if this sub expansion is included
-
canExpand
public boolean canExpand()Check if the current property can be expanded- Returns:
- true if the current property can be expanded
-
getExpansion
Get expansion at a specific sub node. Expansion will have all sub nodes of the sub node. If the expansion you are getting does not exist,NONE
will be returned.- Parameters:
name
- of the sub expansion to get- Returns:
- Expansion for the sub node
-
getSubExpansion
Get expansion at a specific sub node. Expansion will have all sub nodes of the sub node. The expansion you are getting must exist, so please usecanExpand(String)
first- Parameters:
name
- of the sub expansion to get- Returns:
- Expansion for the sub node
-
toParts
@NotNull protected static @NotNull Pair<String,String> toParts(@NotNull @NotNull String expansionString) Split an expansion string into its first node and rest. e.g. one.two.three would become "one", "two.three"- Parameters:
expansionString
- string to split- Returns:
- pair containing the first node, and remaining nodes. If only one node, pair.snd will be null
-
toString
Flattens the tree into a string format -
equals
-
hashCode
public int hashCode()
-