Package ch.ivyteam.ivy.vars
Interface Variables
-
- All Known Subinterfaces:
IGlobalVariableContext
public interface VariablesThe interface of the var attribute of the ivy class. This parent interface handles variables from yaml files.- Since:
- 9.2
- API:
- This is a public API.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Variable>all()Gets a list of all variables with meta data like default value or descriptionstatic Variablescurrent()Gets the current variables (of current application and actual environment).Stringget(String name)Gets the value of a variable.Set<String>names()Gets the names of the available variables namesstatic Variablesof(IApplication app)Gets the variables of a given application and its active environment.static Variablesof(IApplication app, String env)Gets the variables of the given application and environment.VariablesofEnvironment(String environment)Gets a variables for a specific environment.Stringreset(String name)Resets the value of a variable for the active environment back to the default value.Stringset(String name, String value)Sets the value of a variable for the active environmentVariablevariable(String name)Gets a variable with meta data like default value or description
-
-
-
Method Detail
-
get
String get(String name)
Gets the value of a variable.- Parameters:
name- the name of the variable- Returns:
- the value of the variable if it is defined otherwise an empty string
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
set
String set(String name, String value)
Sets the value of a variable for the active environment- Parameters:
name- the name of the variablevalue- the new value- Returns:
- old value that was set before. Empty string if it was not defined.
- Throws:
IllegalArgumentException- if the variable with the given name does not exists- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
reset
String reset(String name)
Resets the value of a variable for the active environment back to the default value. The default value is the value set on theDefaultenvironment. If the active environment is theDefaultenvironment then this method has no effect.- Parameters:
name- the name of the variable- Returns:
- old value that was set before. Empty string if it was not defined for the active environment
- Throws:
IllegalArgumentException- if the variable with the given name does not exists- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
names
Set<String> names()
Gets the names of the available variables names- Returns:
- set of variable names
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
variable
Variable variable(String name)
Gets a variable with meta data like default value or description- Returns:
- variable
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
all
List<Variable> all()
Gets a list of all variables with meta data like default value or description- Returns:
- all variable
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
ofEnvironment
Variables ofEnvironment(String environment)
Gets a variables for a specific environment.- Returns:
- variables
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
current
static Variables current()
Gets the current variables (of current application and actual environment).
Will return null if called out of scope. The scope is set if you call this method from an ivy process or any supported ivy environment. It is not set in non supported ivy environments (e.g. if you start your own threads, etc.).
- Returns:
- current variables or null if out of scope
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
of
static Variables of(IApplication app)
Gets the variables of a given application and its active environment.
Will return null if given app is null.
- Parameters:
app- application of wanted variables- Returns:
- variables or null
- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
of
static Variables of(IApplication app, String env)
Gets the variables of the given application and environment.
If the environment is null, empty ("") the
IEnvironment.DEFAULT_ENVIRONMENT_NAMEenvironment will be used.Will return null if given app is null
- Parameters:
app- application of wanted variables- Returns:
- variables or null
- Throws:
IllegalArgumentException- if given environment is not found on the app- Since:
- 9.2
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-