Class ParameterSet

java.lang.Object
com.myscript.iink.ParameterSet
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
Configuration

public class ParameterSet extends Object implements AutoCloseable
Represents a set of iink parameters.
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • isClosed

      public final boolean isClosed()
      Tells whether the close() method has been called. Once an object is closed any method will throw IllegalStateException.
      Returns:
      true if this object is closed.
    • checkNotClosed

      protected final void checkNotClosed()
    • getSection

      @NotNull public final @NotNull ParameterSet getSection(@NotNull @NotNull String key)
      Returns a parameter set object representing the section associated with key. Sections correspond to the hierarchical organization of keys according to their dots. For example, if you have keys "a.b.c" and "a.b.d" there is a section "a.b" that contains keys "c" and "d", as well as a section "a" containing "b.c" and "b.d".

      Note: make sure to close the returned object.

      Parameters:
      key - the key of the section to obtain.
      Returns:
      the section.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a section.
    • getString

      @NotNull public final @NotNull String getString(@NotNull @NotNull String key)
      Returns the string value associated with key.
      Parameters:
      key - the key of the value to obtain.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a string.
    • getString

      @NotNull public final @NotNull String getString(@NotNull @NotNull String key, @NotNull @NotNull String defaultValue)
      Returns the string value associated with key.
      Parameters:
      key - the key of the value to obtain.
      defaultValue - the value to return when key is not present.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a string.
    • setString

      public final void setString(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Sets the string value associated with key.
      Parameters:
      key - the key of the value to set.
      value - the string value to set.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a string.
    • getBoolean

      @NotNull public final @NotNull Boolean getBoolean(@NotNull @NotNull String key)
      Returns the boolean value associated with key.
      Parameters:
      key - the key of the value to obtain.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a boolean.
    • getBoolean

      @NotNull public final @NotNull Boolean getBoolean(@NotNull @NotNull String key, boolean defaultValue)
      Returns the boolean value associated with key.
      Parameters:
      key - the key of the value to obtain.
      defaultValue - the value to return when key is not present.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a boolean.
    • setBoolean

      public final void setBoolean(@NotNull @NotNull String key, Boolean value)
      Sets the boolean value associated with key.
      Parameters:
      key - the key of the value to set.
      value - the boolean value to set.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a boolean.
    • getNumber

      @NotNull public final @NotNull Number getNumber(@NotNull @NotNull String key)
      Returns the numeric value associated with key.
      Parameters:
      key - the key of the value to obtain.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a number.
    • getNumber

      @NotNull public final @NotNull Number getNumber(@NotNull @NotNull String key, @NotNull @NotNull Number defaultValue)
      Returns the numeric value associated with key.
      Parameters:
      key - the key of the value to obtain.
      defaultValue - the value to return when key is not present.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a number.
    • setNumber

      public final void setNumber(@NotNull @NotNull String key, @NotNull @NotNull Number value)
      Sets the numeric value associated with key.
      Parameters:
      key - the key of the value to set.
      value - the number value to set.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a number.
    • getStringArray

      @NotNull public final @NotNull String[] getStringArray(@NotNull @NotNull String key)
      Returns the string array value associated with key.
      Parameters:
      key - the key of the value to obtain.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a string array.
    • getStringArray

      @NotNull public final @NotNull String[] getStringArray(@NotNull @NotNull String key, @NotNull @NotNull String[] defaultValue)
      Returns the string array associated with key.
      Parameters:
      key - the key of the value to obtain.
      defaultValue - the value to return when key is not present.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key is not a string array.
      Since:
      1.4
    • setStringArray

      public final void setStringArray(@NotNull @NotNull String key, @NotNull @NotNull String[] value)
      Sets the string array value associated with key.
      Parameters:
      key - the key of the value to set.
      value - the value to set.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a string array.
    • getNumberArray

      @NotNull public final @NotNull Number[] getNumberArray(@NotNull @NotNull String key)
      Returns the numeric array value associated with key.
      Parameters:
      key - the key of the value to obtain.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when key is not found.
      IllegalStateException - when entry at key is not a Number array.
      Since:
      3.1
    • getNumberArray

      @NotNull public final @NotNull Number[] getNumberArray(@NotNull @NotNull String key, @NotNull @NotNull Number[] defaultValue)
      Returns the numeric array associated with key.
      Parameters:
      key - the key of the value to obtain.
      defaultValue - the value to return when key is not present.
      Returns:
      the value.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key is not a Number array.
      Since:
      3.1
    • setNumberArray

      public final void setNumberArray(@NotNull @NotNull String key, @NotNull @NotNull Number[] value)
      Sets the numeric array value associated with key.
      Parameters:
      key - the key of the value to set.
      value - the value to set.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalStateException - when entry at key exists and is not a Number array.
      Since:
      3.1
    • inject

      public final void inject(@NotNull @NotNull String json)
      Injects the content of a JSON values into this parameter set.
      Parameters:
      json - JSON parameter set values.
      Throws:
      IllegalStateException - when this parameter set is closed.
      IllegalArgumentException - when json is not valid JSON.