Class ConfigKey<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigKey​(ConfigMeta meta, java.lang.Class<T> clazz, T dflt)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T cast​(java.lang.Object value)
      Converts an object to the value type of this key.
      abstract Specifier<T> createSpecifier()
      Constructs a graphical control with which the user can specify a suitable value for association with this key.
      T getDefaultValue()
      Returns the default value associated with this key.
      ConfigMeta getMeta()
      Returns metadata about this key.
      java.lang.Class<T> getValueClass()
      Returns the type of value described by this key.
      abstract T stringToValue​(java.lang.String txt)
      Decodes a string value to the value type of this key.
      java.lang.String toString()  
      abstract java.lang.String valueToString​(T value)
      Reports a value as a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConfigKey

        public ConfigKey​(ConfigMeta meta,
                         java.lang.Class<T> clazz,
                         T dflt)
        Constructor.
        Parameters:
        meta - metadata describing this key
        clazz - value type for the values indexed by this key
        dflt - default value when key not present in map
    • Method Detail

      • getMeta

        public ConfigMeta getMeta()
        Returns metadata about this key.
        Returns:
        metadata
      • getValueClass

        public java.lang.Class<T> getValueClass()
        Returns the type of value described by this key.
        Returns:
        class
      • getDefaultValue

        public T getDefaultValue()
        Returns the default value associated with this key. This value may be used when no value is explicitly supplied for this key.
        Returns:
        default value
      • cast

        public T cast​(java.lang.Object value)
        Converts an object to the value type of this key.
        Parameters:
        value - untyped value
        Returns:
        typed value
      • stringToValue

        public abstract T stringToValue​(java.lang.String txt)
                                 throws ConfigException
        Decodes a string value to the value type of this key. An empty string should be interpreted as a null value, but this may cause an exception if null is not a permissible value for this key.
        Parameters:
        txt - string representation of value
        Returns:
        value
        Throws:
        ConfigException
      • valueToString

        public abstract java.lang.String valueToString​(T value)
        Reports a value as a string. If at all possible the roundtripping should be possible, so stringToValue(valueToString(v)).equals(v). A null value, if permitted, should be represented as an empty string.
        Parameters:
        value - possible value associated with this key
        Returns:
        string representation
      • createSpecifier

        public abstract Specifier<T> createSpecifier()
        Constructs a graphical control with which the user can specify a suitable value for association with this key.
        Returns:
        new specifier
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object