Package ch.ivyteam.ivy.globalvars
Interface IGlobalVariableContext
-
- All Superinterfaces:
ch.ivyteam.ivy.scripting.IProjectSpecificClass
public interface IGlobalVariableContext extends ch.ivyteam.ivy.scripting.IProjectSpecificClass
The interface of the var attribute of the ivy class. This interface does not provide any thing. The different variables are added dynamically per ivy script class.- Since:
- 28.05.2009
- API:
- This is a public API.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static IGlobalVariableContext
current()
Gets the current global variable context.String
get(String varName)
Gets the value of a global variable.String
getForEnvironment(String environment, String name)
Gets the value of a global variable for the given environmentString
reset(String name)
Resets the value of a global variable for the active environment back to the default value.String
resetForEnvironment(String environment, String name)
Resets the value of a global variable for the given environment back to the default value.String
set(String name, String value)
Sets the value of a global variable for the active environmentString
setForEnvironment(String environment, String name, String value)
Sets the value of a global variable for the given environment
-
-
-
Method Detail
-
get
String get(String varName)
Gets the value of a global variable.- Parameters:
varName
- 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 global 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 global 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 global 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 global 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.
-
getForEnvironment
String getForEnvironment(String environment, String name)
Gets the value of a global variable for the given environment- Parameters:
environment
- the name of the environmentname
- the name of the variable- Returns:
- the value for the environment. Empty string if no value is defined for the environment
- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
setForEnvironment
String setForEnvironment(String environment, String name, String value)
Sets the value of a global variable for the given environment- Parameters:
environment
- the name of the environmentname
- 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 global variable with the given name or the given environment do not exists- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
resetForEnvironment
String resetForEnvironment(String environment, String name)
Resets the value of a global variable for the given environment back to the default value. The default value is the value set on theDefault
environment. This method has no effect if you provideDefault
as environment.- Parameters:
name
- the name of the variable- Returns:
- old value that was set before. Empty string if no value was defined for the environment
- Throws:
IllegalArgumentException
- if the global variable with the given name or the given environment do not exists- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
current
static IGlobalVariableContext current()
Gets the current global variable context.
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 global variable context or null if out of scope
- Since:
- 9.1
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-