Class SerialGetter

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>, Getter
Direct Known Subclasses:
PropertyGetter, StringGetter

public abstract class SerialGetter extends Properties implements Getter
This class extends Properties implements the Getter interface and is used to store and easily retrieves objects.
See Also:
  • Constructor Details

    • SerialGetter

      public SerialGetter()
      Creates an empty SerialGetter
    • SerialGetter

      public SerialGetter(boolean ignoreCase)
      Creates a new empty SerialGetter, key sensitive or not depending on the value of the parameter
      Parameters:
      ignoreCase - false to create a key sensitive SerialGetter, true otherwise
  • Method Details

    • getBoolean

      public Boolean getBoolean(String key, Boolean def)
      Returns the Boolean value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getBoolean in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a Boolean
      Returns:
      Boolean.TRUE if the value is "true" or "1", Boolean.FALSE if the value is "false" or "0", the default Boolean value otherwise
    • getboolean

      public boolean getboolean(String key, boolean def)
      Returns the boolean value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getboolean in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a boolean
      Returns:
      true if the value is "true" or "1", false if the value is "false" or "0", the default boolean value otherwise
    • getLong

      public Long getLong(String key, Long def)
      Returns the Long value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getLong in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a Long
      Returns:
      The Long value that corresponds to the key, or the default one
    • getlong

      public long getlong(String key, long def)
      Returns the long value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getlong in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a long
      Returns:
      The long value that corresponds to the key, or the default one
    • getInteger

      public Integer getInteger(String key, Integer def)
      Returns the Integer value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getInteger in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into an Integer
      Returns:
      The Integer value that corresponds to the key, or the default one
    • getint

      public int getint(String key, int def)
      Returns the int value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getint in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into an int
      Returns:
      The int value that corresponds to the key, or the default one
    • getFloat

      public Float getFloat(String key, Float def)
      Returns the Float value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getFloat in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a Float
      Returns:
      The Float value that corresponds to the key, or the default one
    • getfloat

      public float getfloat(String key, float def)
      Returns the float value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getfloat in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a float
      Returns:
      The float value that corresponds to the key, or the default one
    • getDouble

      public Double getDouble(String key, Double def)
      Returns the Double value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getDouble in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a Double
      Returns:
      The Double value that corresponds to the key, or the default one
    • getdouble

      public double getdouble(String key, double def)
      Returns the double value that corresponds to the key passed as parameter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getdouble in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a double
      Returns:
      The double value that corresponds to the key, or the default one
    • getDate

      public Date getDate(String key, Date def, SimpleDateFormat sdf)
      Returns the Date value, formatted using the SimpleDateFormat passed as parameter, that corresponds to the key. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getDate in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter or if the string value cannot be transformed into a Date
      sdf - Teh SimpleDateFormat used to parse the date
      Returns:
      The Date value that corresponds to the key, or the default one
    • getString

      public String getString(String key, String def)
      Returns the String value that corresponds to the key. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      getString in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter
      Returns:
      The String value that corresponds to the key, or the default one
    • keyIterator

      public Iterator keyIterator()
      Returns the Iterator used to iterate over all the entries
      Specified by:
      keyIterator in interface Getter
      Returns:
      The iterator on the entries of the SerialGetter
    • get

      public Object get(String key)
      Returns the Object that corresponds to the key passed as parameters. In this case there isn't a default value.
      The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      get in interface Getter
      Parameters:
      key - The name of the key
      Returns:
      The object associated to the key passed as parameter, or null if the SerialGetter contains no mapping for the key
    • get

      public Object get(String key, Object def)
      Returns the Object that corresponds to the key passed as parameters. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      get in interface Getter
      Parameters:
      key - The name of the key
      def - The default value returned if the key is not present in the SerialGetter
      Returns:
      The object associated to the key passed as parameter, or the default one
    • containsKey

      public boolean containsKey(String key)
      Checks if the specified key is within this SerialGetter. The search mode will not be key sensitive if this has been requested by the constructor SerialGetter(boolean)
      Specified by:
      containsKey in interface Getter
      Parameters:
      key - The key checked
      Returns:
      true if the key is present, false otherwise
    • put

      public Object put(Object key, Object value)
      Maps the specified key to the specified value in this SerialGetter.
      Specified by:
      put in interface Map<Object,Object>
      Overrides:
      put in class Properties
      Parameters:
      key - The name of the key
      value - The value
      Returns:
      The previous value of the specified key in this SerialGetter, or null if it did not have one
    • putAll

      public void putAll(Map<?,?> t)
      Specified by:
      putAll in interface Map<Object,Object>
      Overrides:
      putAll in class Properties