Class Settings

java.lang.Object
com.inductiveautomation.snap.web.Settings
All Implemented Interfaces:
RMJSONArchiver.GetClass, RMJSONArchiver.GetKeys, RMJSONArchiver.GetValue, RMJSONArchiver.SetValue, RMKey.Get, RMKey.GetSet, WebFile.Updater

An object to get, set and store site settings.
  • Constructor Details

    • Settings

      public Settings()
      Creates new Settings.
    • Settings

      public Settings(WebFile aFile)
      Creates a new Settings from a byte source.
  • Method Details

    • getFile

      public WebFile getFile()
      Returns the source file.
    • get

      public Object get(String aKey)
      Returns a value.
    • get

      public Object get(String aKey, Object aDefault)
      Returns a value.
    • get

      public <T> T get(String aKey, Class<T> aClass)
      Returns a value of a given class.
    • put

      public void put(String aKey, Object aValue)
      Sets a value.
    • simplePut

      protected Object simplePut(String aKey, Object aValue)
      Sets a value for a simple key without firing property change.
    • getStringValue

      public String getStringValue(String aKey)
      Returns as a String value.
    • getStringValue

      public String getStringValue(String aKey, String aDefault)
      Returns as a String value.
    • getBoolValue

      public boolean getBoolValue(String aKey)
      Returns an bool value.
    • getBoolValue

      public boolean getBoolValue(String aKey, boolean aDefault)
      Returns an bool value.
    • getIntValue

      public int getIntValue(String aKey)
      Returns an int value.
    • getIntValue

      public int getIntValue(String aKey, int aDefault)
      Returns an int value.
    • getFloatValue

      public float getFloatValue(String aKey)
      Returns a float value.
    • getFloatValue

      public float getFloatValue(String aKey, float aDefault)
      Returns a float value.
    • getList

      public Settings.SettingsList getList(String aKey)
      Returns a List value.
    • getList

      public Settings.SettingsList getList(String aKey, boolean doCreate)
      Returns a List value, with option to create if missing.
    • addListItem

      public void addListItem(String aKey, Object aValue)
      Adds a list item.
    • addListItem

      public void addListItem(String aKey, Object aValue, int anIndex)
      Adds a list item at given index.
    • removeListItem

      public Object removeListItem(String aKey, int anIndex)
      Removes a list item at given index.
    • removeListItem

      public int removeListItem(String aKey, Object aValue)
      Removes a list item at given index.
    • getSettings

      public Settings getSettings(String aKey)
      Returns the settings for key.
    • getSettings

      public Settings getSettings(String aKey, boolean doCreate)
      Returns the settings for key, with option to create if missing.
    • firePropertyChange

      protected void firePropertyChange(String aName, Object oldVal, Object newVal, int anIndex)
      Override to forward to parents if present.
    • getJSONClass

      public String getJSONClass()
      Description copied from interface: RMJSONArchiver.GetClass
      Returns a list of keys to be uses to retrieve persistent attributes from an object.
      Specified by:
      getJSONClass in interface RMJSONArchiver.GetClass
    • setJSONValue

      public void setJSONValue(String aKey, Object aValue)
      Description copied from interface: RMJSONArchiver.SetValue
      Returns a list of keys to be uses to retrieve persistent attributes from an object.
      Specified by:
      setJSONValue in interface RMJSONArchiver.SetValue
    • getJSONValue

      public Object getJSONValue(String aKey)
      Description copied from interface: RMJSONArchiver.GetValue
      Returns a list of keys to be uses to retrieve persistent attributes from an object.
      Specified by:
      getJSONValue in interface RMJSONArchiver.GetValue
    • getJSONKeys

      public Collection<String> getJSONKeys()
      Description copied from interface: RMJSONArchiver.GetKeys
      Returns a list of keys to be uses to retrieve persistent attributes from an object.
      Specified by:
      getJSONKeys in interface RMJSONArchiver.GetKeys
    • getKeyValue

      public Object getKeyValue(String aKey)
      Specified by:
      getKeyValue in interface RMKey.Get
    • setKeyValue

      public boolean setKeyValue(String aKey, Object aValue)
      Specified by:
      setKeyValue in interface RMKey.GetSet
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
    • updateFile

      public void updateFile(WebFile aFile)
      Saves the file.
      Specified by:
      updateFile in interface WebFile.Updater
    • get

      public static Settings get(WebFile aFile)
      Returns the settings for given file.