Class Setting

  • All Implemented Interfaces:
    java.io.Serializable

    public class Setting
    extends java.lang.Object
    implements java.io.Serializable
    A setting that is stored in the database. Just like in an ini-file, a setting is identified by it's name and section, which together must be unique. Both name and section are not case-sensitive. The length of the value of a regular setting is limited to 2KB. A setting with a long value is limited by the maximum size of a CLOB field in the database.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Setting​(java.lang.String value, java.lang.String name, java.lang.String section)
      Creates a new setting.
      Setting​(java.lang.String value, java.lang.String name, java.lang.String section, boolean longValue)
      Creates a new setting with a value that can be longer than 2KB if needed.
      Setting​(java.lang.String value, java.lang.String name, java.lang.String section, boolean longValue, java.util.Date lastModified)
      Creates a new setting with a value that can be longer than 2KB if needed and a timestamp.
    • Constructor Detail

      • Setting

        public Setting​(java.lang.String value,
                       java.lang.String name,
                       java.lang.String section)
        Creates a new setting.
        Parameters:
        value - the setting's value as a string limited to 2KB
        name - the setting's name as a string limited to 512B
        section - the setting's section as a string limited to 512B
      • Setting

        public Setting​(java.lang.String value,
                       java.lang.String name,
                       java.lang.String section,
                       boolean longValue)
        Creates a new setting with a value that can be longer than 2KB if needed.
        Parameters:
        value - the setting's value. If longValue is set to true this can be longer than 2KB. Note that due to performance reasons, long values cannot hold unicode characters. You should encode the value to base64 if needed.
        longValue - if true, the length of the value-string can exceed 2KB
        name - the setting's name as a string limited to 512B
        section - the setting's section as a string limited to 512B
      • Setting

        public Setting​(java.lang.String value,
                       java.lang.String name,
                       java.lang.String section,
                       boolean longValue,
                       java.util.Date lastModified)
        Creates a new setting with a value that can be longer than 2KB if needed and a timestamp. To be used internally. Note that the last-modified date is set by the server automatically.
        Parameters:
        value - the setting's value. If longValue is set to true this can be longer than 2KB. Note that due to performance reasons, long values cannot hold unicode characters. You should encode the value to base64 if needed.
        longValue - if true, the length of the value-string can exceed 2KB
        name - the setting's name as a string limited to 512B
        section - the setting's section as a string limited to 512B
        lastModified - the date at which this setting was last modified
    • Method Detail

      • getValue

        public java.lang.String getValue()
        Returns:
        the setting's value
      • getName

        public java.lang.String getName()
        Returns:
        the setting's name
      • getSection

        public java.lang.String getSection()
        Returns:
        the setting's section
      • setValue

        public void setValue​(java.lang.String value)
        Parameters:
        value - the new value (limited to 2KB)
      • setLongValue

        public void setLongValue​(java.lang.String value)
        Parameters:
        value - the new value. Can be longer than 2KB.
      • isLongSetting

        public boolean isLongSetting()
        Returns:
        whether the value of the setting can be long (>2KB) or not
      • getLastModified

        public java.util.Date getLastModified()
        Returns:
        the date at which this setting was modified last
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)