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 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 variable
        value - 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 the Default environment. If the active environment is the Default 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 environment
        name - 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 environment
        name - the name of the variable
        value - 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 the Default environment. This method has no effect if you provide Default 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.