ControllerProperties (Javadocs: controlP5)

controlP5

## Class ControllerProperties

- java.lang.Object
- - controlP5.ControllerProperties

-     public class ControllerProperties
      extends java.lang.Object

  Values of controllers can be stored inside properties files which can be saved to file or memory.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CLOSE`
    `static java.lang.String` | `defaultName`
    `static java.util.logging.Logger` | `logger`
    `static int` | `OPEN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ControllerProperties(ControlP5 theControlP5)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ControllerProperties` | `addSet(java.lang.String theSet)`
    `ControllerProperties` | `copy(ControllerInterface<?> theController, java.lang.String... theSet)`
    `ControllerProperties` | `copy(ControllerProperty theProperty, java.lang.String... theSet)` copies a ControllerProperty from one set to other(s);
    `ControllerProperties` | `delete(ControllerProperty theProperty)` deletes a ControllerProperty from all Sets including the default set.
    `java.util.Map<ControllerProperty,java.util.HashSet<java.lang.String>>` | `get()`
    `java.util.List<ControllerProperty>` | `get(ControllerInterface<?> theController)`
    `ControllerProperty` | `getProperty(ControllerInterface<?> theController, java.lang.String theProperty)`
    `ControllerProperty` | `getProperty(ControllerInterface<?> theController, java.lang.String theSetter, java.lang.String theGetter)`
    `java.util.HashSet<ControllerProperty>` | `getPropertySet(ControllerInterface<?> theController)`
    `ControllerProperties` | `getSnapshot(java.lang.String theKey)` restores properties previously stored as snapshot in memory.
    `java.util.ArrayList<java.lang.String>` | `getSnapshotIndices()` properties stored in memory can be accessed by index, getSnapshotIndices() returns the index of the snapshot list.
    `boolean` | `load()` load properties from the default properties file 'controlP5.properties'
    `boolean` | `load(java.lang.String thePropertiesPath)`
    `ControllerProperties` | `move(ControllerInterface<?> theController, java.lang.String fromSet, java.lang.String toSet)`
    `ControllerProperties` | `move(ControllerProperty theProperty, java.lang.String fromSet, java.lang.String toSet)` Moves a ControllerProperty from one set to another.
    `ControllerProperties` | `only(ControllerProperty theProperty, java.lang.String theSet)` stores a ControllerProperty in one particular set only.
    `ControllerProperties` | `print()`
    `ControllerProperties` | `register(ControllerInterface<?> theController, java.lang.String theProperty)` registering a property with only one parameter assumes that there is a setter and getter function present for the Controller.
    `ControllerProperty` | `register(ControllerInterface<?> theController, java.lang.String thePropertySetter, java.lang.String thePropertyGetter)` adds a property based on names of setter and getter methods of a controller.
    `ControllerProperties` | `remove(ControllerInterface<?> theController)`
    `ControllerProperties` | `remove(ControllerInterface<?> theController, java.lang.String... theSet)`
    `ControllerProperties` | `remove(ControllerInterface<?> theController, java.lang.String theProperty)`
    `ControllerProperties` | `remove(ControllerInterface<?> theController, java.lang.String theSetter, java.lang.String theGetter)`
    `ControllerProperties` | `remove(ControllerProperty theProperty, java.lang.String... theSet)` removes a ControllerProperty from one or multiple sets.
    `ControllerProperties` | `removeSnapshot(java.lang.String theKey)` removes a snapshot by key.
    `boolean` | `save()` saves all registered properties into the default 'controlP5.properties' file into your sketch folder.
    `boolean` | `saveAs(java.lang.String thePropertiesPath)` saves all registered properties into a file specified by parameter thePropertiesPath.
    `boolean` | `saveAs(java.lang.String thePropertiesPath, java.lang.String... theSets)` saves a list of properties sets into a file specified by parameter thePropertiesPath.
    `ControllerProperties` | `saveSnapshot(java.lang.String theKey)` saves a snapshot into your sketch's sketch folder.
    `ControllerProperties` | `saveSnapshotAs(java.lang.String thePropertiesPath, java.lang.String theKey)` saves a snapshot to the file with path given by the first parameter (thePropertiesPath).
    `void` | `setFormat(controlP5.ControllerProperties.PropertiesStorageFormat theFormat)` use ControllerProperties.SERIALIZED, ControllerProperties.XML or ControllerProperties.JSON as parameter.
    `void` | `setFormat(java.lang.String theFormat)`
    `ControllerProperties` | `setSnapshot(java.lang.String theKey)` logs all registered properties in memory.
    `java.lang.String` | `toString()`
    `ControllerProperties` | `updateSnapshot(java.lang.String theKey)` convenience method, setSnapshot(String) also works here since it will override existing log with the same key.

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

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

- - ### Field Detail

    - #### CLOSE

          public static final int CLOSE

      See Also:
        Constant Field Values

    - #### defaultName

          public static java.lang.String defaultName

    - #### logger

          public static final java.util.logging.Logger logger

    - #### OPEN

          public static final int OPEN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ControllerProperties

          public ControllerProperties(ControlP5 theControlP5)

  - ### Method Detail

    - #### addSet

          public ControllerProperties addSet(java.lang.String theSet)

    - #### copy

          public ControllerProperties copy(ControllerInterface<?> theController,
                                           java.lang.String... theSet)

    - #### copy

          public ControllerProperties copy(ControllerProperty theProperty,
                                           java.lang.String... theSet)

      copies a ControllerProperty from one set to other(s);

    - #### delete

          public ControllerProperties delete(ControllerProperty theProperty)

      deletes a ControllerProperty from all Sets including the default set.

    - #### get

          public java.util.Map<ControllerProperty,java.util.HashSet<java.lang.String>> get()

    - #### get

          public java.util.List<ControllerProperty> get(ControllerInterface<?> theController)

    - #### getProperty

          public ControllerProperty getProperty(ControllerInterface<?> theController,
                                                java.lang.String theProperty)

    - #### getProperty

          public ControllerProperty getProperty(ControllerInterface<?> theController,
                                                java.lang.String theSetter,
                                                java.lang.String theGetter)

    - #### getPropertySet

          public java.util.HashSet<ControllerProperty> getPropertySet(ControllerInterface<?> theController)

    - #### getSnapshot

          public ControllerProperties getSnapshot(java.lang.String theKey)

      restores properties previously stored as snapshot in memory.
      See Also:
        `setSnapshot(String)`

    - #### getSnapshotIndices

          public java.util.ArrayList<java.lang.String> getSnapshotIndices()

      properties stored in memory can be accessed by index, getSnapshotIndices() returns the index of the snapshot list.

    - #### load

          public boolean load()

      load properties from the default properties file 'controlP5.properties'

    - #### load

          public boolean load(java.lang.String thePropertiesPath)

    - #### move

          public ControllerProperties move(ControllerInterface<?> theController,
                                           java.lang.String fromSet,
                                           java.lang.String toSet)

    - #### move

          public ControllerProperties move(ControllerProperty theProperty,
                                           java.lang.String fromSet,
                                           java.lang.String toSet)

      Moves a ControllerProperty from one set to another.

    - #### only

          public ControllerProperties only(ControllerProperty theProperty,
                                           java.lang.String theSet)

      stores a ControllerProperty in one particular set only.

    - #### print

          public ControllerProperties print()

    - #### register

          public ControllerProperties register(ControllerInterface<?> theController,
                                               java.lang.String theProperty)

      registering a property with only one parameter assumes that there is a setter and getter function present for the Controller. register("value") for example would create a property reference to setValue and getValue. Notice that the first letter of value is being capitalized.
      Parameters:
        `theProperty` -
      Returns:

    - #### register

          public ControllerProperty register(ControllerInterface<?> theController,
                                             java.lang.String thePropertySetter,
                                             java.lang.String thePropertyGetter)

      adds a property based on names of setter and getter methods of a controller.
      Parameters:
        `thePropertySetter` -
        `thePropertyGetter` -

    - #### remove

          public ControllerProperties remove(ControllerInterface<?> theController)

    - #### remove

          public ControllerProperties remove(ControllerInterface<?> theController,
                                             java.lang.String... theSet)

    - #### remove

          public ControllerProperties remove(ControllerInterface<?> theController,
                                             java.lang.String theProperty)

    - #### remove

          public ControllerProperties remove(ControllerInterface<?> theController,
                                             java.lang.String theSetter,
                                             java.lang.String theGetter)

    - #### remove

          public ControllerProperties remove(ControllerProperty theProperty,
                                             java.lang.String... theSet)

      removes a ControllerProperty from one or multiple sets.

    - #### removeSnapshot

          public ControllerProperties removeSnapshot(java.lang.String theKey)

      removes a snapshot by key.

    - #### save

          public boolean save()

      saves all registered properties into the default 'controlP5.properties' file into your sketch folder.

    - #### saveAs

          public boolean saveAs(java.lang.String thePropertiesPath)

      saves all registered properties into a file specified by parameter thePropertiesPath.

    - #### saveAs

          public boolean saveAs(java.lang.String thePropertiesPath,
                                java.lang.String... theSets)

      saves a list of properties sets into a file specified by parameter thePropertiesPath.

    - #### saveSnapshot

          public ControllerProperties saveSnapshot(java.lang.String theKey)

      saves a snapshot into your sketch's sketch folder.

    - #### saveSnapshotAs

          public ControllerProperties saveSnapshotAs(java.lang.String thePropertiesPath,
                                                     java.lang.String theKey)

      saves a snapshot to the file with path given by the first parameter (thePropertiesPath).

    - #### setFormat

          public void setFormat(controlP5.ControllerProperties.PropertiesStorageFormat theFormat)

      use ControllerProperties.SERIALIZED, ControllerProperties.XML or ControllerProperties.JSON as parameter.

    - #### setFormat

          public void setFormat(java.lang.String theFormat)

    - #### setSnapshot

          public ControllerProperties setSnapshot(java.lang.String theKey)

      logs all registered properties in memory. Here, clones of properties are stored inside a map and can be accessed by key using the getLog method.
      Parameters:
        `theKey` -
      Returns:
        ControllerProperties
      See Also:
        `getSnapshot(String)`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### updateSnapshot

          public ControllerProperties updateSnapshot(java.lang.String theKey)

      convenience method, setSnapshot(String) also works here since it will override existing log with the same key.

processing library controlP5 by Andreas Schlegel. (c) 2006-2015