Package org.eclipse.cdt.utils.envvar

## Class StorableEnvironment

- java.lang.Object
- - org.eclipse.cdt.utils.envvar.StorableEnvironment

Direct Known Subclasses:
  `PrefsStorableEnvironment`

    public class StorableEnvironment
    extends Object

This class represents the set of environment variables that could be loaded and stored in XML

Since:
  3.0

### Field Summary

Fields
`static String` `ENVIRONMENT_ELEMENT_NAME`

### Constructor Summary

Constructors
`StorableEnvironment​(boolean isReadOnly)` Create new empty StorableEnvironment
`StorableEnvironment​(IEnvironmentVariable[] variables, boolean isReadOnly)`
`StorableEnvironment​(ICStorageElement element, boolean isReadOnly)` Initialize the StorableEnvironment from an ICStorageElement tree
`StorableEnvironment​(StorableEnvironment env, boolean isReadOnly)` Copy constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `appendContributedEnvironment()`
`boolean` `appendEnvironment()`
`IEnvironmentVariable` `checkVariable​(String name, String value, int op, String delimiter)`
`IEnvironmentVariable` `createVariable​(String name)`
`IEnvironmentVariable` `createVariable​(String name, String value)`
`IEnvironmentVariable` `createVariable​(String name, String value, int op, String delimiter)`
`IEnvironmentVariable` `createVariable​(String name, String value, String delimiter)`
`void` `createVriables​(IEnvironmentVariable[] vars)`
`boolean` `deleteAll()`
`IEnvironmentVariable` `deleteVariable​(String name)`
`IEnvironmentVariable` `getVariable​(String name)`
`IEnvironmentVariable[]` `getVariables()`
`boolean` `isChanged()` Returns the "change" state of the environment.
`boolean` `isDirty()` Returns the "dirty" state of the environment.
`boolean` `isReadOnly()`
`void` `restoreDefaults()`
`void` `serialize​(ICStorageElement element)` Serialize the Storable enviornment into the ICStorageElement NB assumes that any variables part of the ISerializeInfo will continue to be serialized
`void` `setAppendContributedEnvironment​(boolean append)`
`void` `setAppendEnvironment​(boolean append)`
`void` `setChanged​(boolean changed)` sets the "change" state of the environment
`void` `setDirty​(boolean dirty)` sets the "dirty" state of the environment
`void` `setVariales​(IEnvironmentVariable[] vars)` Set the enviornment variables in this `StorableEnvironment`

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

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

### Field Detail

#### ENVIRONMENT_ELEMENT_NAME

    public static final String ENVIRONMENT_ELEMENT_NAME

See Also:
  Constant Field Values

### Constructor Detail

#### StorableEnvironment

    public StorableEnvironment​(IEnvironmentVariable[] variables,
                               boolean isReadOnly)

Parameters:
  `variables` -
  `isReadOnly` -

#### StorableEnvironment

    public StorableEnvironment​(boolean isReadOnly)

Create new empty StorableEnvironment

Parameters:
  `isReadOnly` -

#### StorableEnvironment

    public StorableEnvironment​(StorableEnvironment env,
                               boolean isReadOnly)

Copy constructor. Creates a new StorableEnvironment from an existing StorableEnvironment. Settings are copied wholesale from the previous enviornment. Note that the previous environment's `StorableEnvironmentLoader.ISerializeInfo` isn't copied over, as it's expected this environment's settings will be stored elsewhere

Parameters:
  `env` -
  `isReadOnly` -

#### StorableEnvironment

    public StorableEnvironment​(ICStorageElement element,
                               boolean isReadOnly)

Initialize the StorableEnvironment from an ICStorageElement tree

Parameters:
  `element` -
  `isReadOnly` -

### Method Detail

#### serialize

    public void serialize​(ICStorageElement element)

Serialize the Storable enviornment into the ICStorageElement NB assumes that any variables part of the ISerializeInfo will continue to be serialized

Parameters:
  `element` -

#### createVariable

    public IEnvironmentVariable createVariable​(String name,
                                               String value,
                                               int op,
                                               String delimiter)

#### createVariable

    public IEnvironmentVariable createVariable​(String name)

#### createVariable

    public IEnvironmentVariable createVariable​(String name,
                                               String value)

#### createVariable

    public IEnvironmentVariable createVariable​(String name,
                                               String value,
                                               String delimiter)

#### checkVariable

    public IEnvironmentVariable checkVariable​(String name,
                                              String value,
                                              int op,
                                              String delimiter)

#### isDirty

    public boolean isDirty()

Returns the "dirty" state of the environment. If the dirty state is `true`, that means that the environment is out of synch with the repository and the environment needs to be serialized.
The dirty state is automatically set to `false` when the environment is serialized by calling the serialize() method

Returns:
  boolean

#### setDirty

    public void setDirty​(boolean dirty)

sets the "dirty" state of the environment

Parameters:
  `dirty` - represents the new state

#### isChanged

    public boolean isChanged()

Returns the "change" state of the environment. The "change" state represents whether the environment was changed or not. This state is not reset when the serialize() method is called Users can use this state to monitor whether the environment was changed or not. This state can be reset to `false` only by calling the setChanged(false) method

Returns:
  boolean

#### setChanged

    public void setChanged​(boolean changed)

sets the "change" state of the environment

Parameters:
  `changed` - represents the new "change" state

#### getVariable

    public IEnvironmentVariable getVariable​(String name)

Parameters:
  `name` -
Returns:
  the environment variable with the given name, or null

#### setVariales

    public void setVariales​(IEnvironmentVariable[] vars)

Set the enviornment variables in this `StorableEnvironment`

Parameters:
  `vars` -

#### createVriables

    public void createVriables​(IEnvironmentVariable[] vars)

#### getVariables

    public IEnvironmentVariable[] getVariables()

#### deleteVariable

    public IEnvironmentVariable deleteVariable​(String name)

#### deleteAll

    public boolean deleteAll()

#### isReadOnly

    public boolean isReadOnly()

#### appendEnvironment

    public boolean appendEnvironment()

#### setAppendEnvironment

    public void setAppendEnvironment​(boolean append)

#### appendContributedEnvironment

    public boolean appendContributedEnvironment()

#### setAppendContributedEnvironment

    public void setAppendContributedEnvironment​(boolean append)

#### restoreDefaults

    public void restoreDefaults()