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.static Variables
of
(IApplication app, String env) Deprecated, for removal: This API element is subject to removal in a future version.ofEnvironment
(String environment) Gets a variables for a specific 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 IvyScript and Java. It has the visibility EXPERT.
-
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 IvyScript and Java. It has the visibility EXPERT.
-
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 IvyScript and Java. It has the visibility EXPERT.
-
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
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
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
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
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
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
Deprecated, for removal: This API element is subject to removal in a future version.Gets the variables of the given application and environment.
If the environment is null, empty ("") the
IEnvironment.DEFAULT_ENVIRONMENT_NAME
environment 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.
-