Class Expansion
- java.lang.Object
-
- com.atlassian.bamboo.rest.model.expansion.Expansion
-
@ExperimentalApi public class Expansion extends Object
Represents an expansion tree. An expansion has the initial property to expandnodeand any sub properties will get collected in the subExpansionsIf 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"
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSubExpansion(@Nullable Expansion expansion)Adds a single sub expansion to this expansion.voidaddSubExpansions(@Nullable Collection<Expansion> expansions)Adds sub expansions to this expansion.booleancanExpand()Check if the current property can be expandedbooleancanExpand(@NotNull String name)Check if the given property is a sub node of the current propertybooleanequals(Object o)@NotNull ExpansiongetExpansion(@NotNull String name)Get expansion at a specific sub node.@NotNull StringgetName()@NotNull ExpansiongetSubExpansion(@NotNull String name)Get expansion at a specific sub node.@NotNull Collection<Expansion>getSubExpansions()inthashCode()booleanisRoot()static @NotNull Expansionparse(@Nullable String string)Takes in expansion arguments and parses/splits/merges them into an expansion tree.protected static @NotNull Pair<String,String>toParts(@NotNull String expansionString)Split an expansion string into its first node and rest.StringtoString()Flattens the tree into a string format
-
-
-
Field Detail
-
ROOT_NODE
public static final String ROOT_NODE
- See Also:
- Constant Field Values
-
SELF
public static final Expansion SELF
-
-
Method Detail
-
parse
@NotNull public static @NotNull Expansion parse(@Nullable @Nullable String string)
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
@NotNull public @NotNull String getName()
- Returns:
- The name of the current node of expansion
-
isRoot
public boolean isRoot()
- Returns:
- true if this node is the root node
-
getSubExpansions
@NotNull public @NotNull Collection<Expansion> getSubExpansions()
- Returns:
- a collection of all sub expansions of this node
-
addSubExpansions
public void addSubExpansions(@Nullable @Nullable Collection<Expansion> expansions)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
public void addSubExpansion(@Nullable @Nullable Expansion expansion)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
public boolean canExpand(@NotNull @NotNull String name)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
@NotNull public @NotNull Expansion getExpansion(@NotNull @NotNull String name)
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,NONEwill be returned.- Parameters:
name- of the sub expansion to get- Returns:
- Expansion for the sub node
-
getSubExpansion
@NotNull public @NotNull Expansion getSubExpansion(@NotNull @NotNull String name)
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
public String toString()
Flattens the tree into a string format
-
-