Class EnumGuacamoleProperty<T extends Enum<T>>

  • Type Parameters:
    T - The enum which defines the possible values of this property.
    All Implemented Interfaces:
    GuacamoleProperty<T>

    public abstract class EnumGuacamoleProperty<T extends Enum<T>>
    extends Object
    implements GuacamoleProperty<T>
    A GuacamoleProperty whose possible values are defined by an enum. Possible values may be defined either through providing an explicit mapping or through annotating the enum constant definitions with the EnumGuacamoleProperty.PropertyValue annotation.
    • Constructor Detail

      • EnumGuacamoleProperty

        public EnumGuacamoleProperty​(Map<String,​T> valueMapping)
        Creates a new EnumGuacamoleProperty which parses String property values into corresponding enum constants as defined by the given Map.
        Parameters:
        valueMapping - A Map which maps all legal String values to their corresponding enum constants.
      • EnumGuacamoleProperty

        public EnumGuacamoleProperty​(Class<T> enumClass)
        Creates a new EnumGuacamoleProperty which parses String property values into corresponding enum constants as defined by the EnumGuacamoleProperty.PropertyValue annotations associated with those constants.
        Parameters:
        enumClass - The enum whose annotated constants should be used as legal values of this property.
      • EnumGuacamoleProperty

        public EnumGuacamoleProperty​(String key,
                                     T value,
                                     Object... additional)
                              throws IllegalArgumentException
        Creates a new EnumGuacamoleProperty which parses the given String property values into the given corresponding enum constants.
        Parameters:
        key - The first String value to accept as a legal value of this property.
        value - The enum constant that key should be parsed into.
        additional - Any additional key/value pairs to be included beyond the first. This array must be even in length, where each even element is a String key and each odd element is the enum constant value to be associated with the key immediately preceding it.
        Throws:
        IllegalArgumentException - If any provided key is not a String, if any provided value is not an enum constant from the given enum type, or if the length of additional is not even.
    • Method Detail

      • parseValue

        public T parseValue​(String value)
                     throws org.apache.guacamole.GuacamoleException
        Description copied from interface: GuacamoleProperty
        Parses the given string value into the type associated with this GuacamoleProperty.
        Specified by:
        parseValue in interface GuacamoleProperty<T extends Enum<T>>
        Parameters:
        value - The string value to parse.
        Returns:
        The parsed value.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while parsing the provided value.