CommandlineJava.SysProperties (Apache Ant API)
Date: 2021-07-10

org.apache.tools.ant.types

## Class CommandlineJava.SysProperties

- java.lang.Object
- - org.apache.tools.ant.types.Environment
  - - org.apache.tools.ant.types.CommandlineJava.SysProperties

- All Implemented Interfaces:
    java.lang.Cloneable
  Enclosing class:
    CommandlineJava

      public static class CommandlineJava.SysProperties
      extends Environment
      implements java.lang.Cloneable

  Specialized Environment class for System properties.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.tools.ant.types.Environment

      `Environment.Variable`

  - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.types.Environment

      `variables`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SysProperties()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefinitionsToList(java.util.ListIterator<java.lang.String> listIt)` Add all definitions (including property sets) to a list.
    `void` | `addSysproperties(CommandlineJava.SysProperties ps)` Add a propertyset to the total set.
    `void` | `addSyspropertyset(PropertySet ps)` Add a propertyset to the total set.
    `java.lang.Object` | `clone()` Create a deep clone.
    `java.lang.String[]` | `getVariables()` Get the properties as an array; this is an override of the superclass, as it evaluates all the properties.
    `void` | `restoreSystem()` Restore the system properties to the cached value.
    `void` | `setSystem()` Cache the system properties and set the system properties to the new values.
    `int` | `size()` Get the size of the sysproperties instance.

    - ### Methods inherited from class org.apache.tools.ant.types.Environment

      `addVariable, getVariablesVector`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SysProperties

          public SysProperties()

  - ### Method Detail

    - #### getVariables

          public java.lang.String[] getVariables()
                                          throws BuildException

      Get the properties as an array; this is an override of the superclass, as it evaluates all the properties.
      Overrides:
        `getVariables` in class `Environment`
      Returns:
        the array of definitions; may be null.
      Throws:
        `BuildException` - on error.

    - #### addDefinitionsToList

          public void addDefinitionsToList(java.util.ListIterator<java.lang.String> listIt)

      Add all definitions (including property sets) to a list.
      Parameters:
        `listIt` - list iterator supporting add method.

    - #### size

          public int size()

      Get the size of the sysproperties instance. This merges all property sets, so is not an O(1) operation.
      Returns:
        the size of the sysproperties instance.

    - #### setSystem

          public void setSystem()
                         throws BuildException

      Cache the system properties and set the system properties to the new values.
      Throws:
        `BuildException` - if Security prevented this operation.

    - #### restoreSystem

          public void restoreSystem()
                             throws BuildException

      Restore the system properties to the cached value.
      Throws:
        `BuildException` - if Security prevented this operation, or there were no system properties to restore.

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Create a deep clone.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        a cloned instance of SysProperties.
      Throws:
        `java.lang.CloneNotSupportedException` - for signature.

    - #### addSyspropertyset

          public void addSyspropertyset(PropertySet ps)

      Add a propertyset to the total set.
      Parameters:
        `ps` - the new property set.

    - #### addSysproperties

          public void addSysproperties(CommandlineJava.SysProperties ps)

      Add a propertyset to the total set.
      Parameters:
        `ps` - the new property set.
      Since:
        Ant 1.6.3