Package ch.ivyteam.ivy.vars
Interface Variables
- All Known Subinterfaces:
IGlobalVariableContext
public interface Variables
The 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
Modifier and TypeMethodDescriptionall()
Gets a list of all variables with meta data like default value or descriptionstatic Variables
current()
Gets the current variables (of current application and actual environment).Gets the value of a variable.names()
Gets the names of the available variables namesstatic Variables
of
(IApplication app) Gets the variables of a given application and its active environment.Resets the value of a variable for the active environment back to the default value.Sets the value of a variable for the active environmentGets a variable with meta data like default value or description
-
Method Details
-
get
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 Java.
-
set
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 Java.
-
reset
Resets the value of a variable for the active environment back to the default value. The default value is the value set on theDefault
environment. If the active environment is theDefault
environment 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 Java.
-
names
Gets the names of the available variables names- Returns:
- set of variable names
- Since:
- 9.2
- API:
- This public API is available in Java.
-
variable
Gets a variable with meta data like default value or description- Returns:
- variable
- Since:
- 9.2
- API:
- This public API is available in Java.
-
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 Java.
-
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 Java.
-
of
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 Java.
-