Package org.apache.guacamole.properties
Class EnumGuacamoleProperty<T extends Enum<T>>
java.lang.Object
org.apache.guacamole.properties.EnumGuacamoleProperty<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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
Defines the string value which should be accepted and parsed into the annotated enum constant.static @interface
Defines the string values which should be accepted and parsed into the annotated enum constant. -
Field Summary
Fields inherited from interface org.apache.guacamole.properties.GuacamoleProperty
DELIMITER_PATTERN
-
Constructor Summary
ConstructorsConstructorDescriptionEnumGuacamoleProperty
(Class<T> enumClass) Creates a new EnumGuacamoleProperty which parses String property values into corresponding enum constants as defined by theEnumGuacamoleProperty.PropertyValue
annotations associated with those constants.EnumGuacamoleProperty
(String key, T value, Object... additional) Creates a new EnumGuacamoleProperty which parses the given String property values into the given corresponding enum constants.EnumGuacamoleProperty
(Map<String, T> valueMapping) Creates a new EnumGuacamoleProperty which parses String property values into corresponding enum constants as defined by the given Map. -
Method Summary
Modifier and TypeMethodDescriptionparseValue
(String value) Parses the given string value into the type associated with this GuacamoleProperty.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.guacamole.properties.GuacamoleProperty
getName, parseValueCollection
-
Constructor Details
-
EnumGuacamoleProperty
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
Creates a new EnumGuacamoleProperty which parses String property values into corresponding enum constants as defined by theEnumGuacamoleProperty.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 thatkey
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 ofadditional
is not even.
-
-
Method Details
-
parseValue
Description copied from interface:GuacamoleProperty
Parses the given string value into the type associated with this GuacamoleProperty.- Specified by:
parseValue
in interfaceGuacamoleProperty<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.
-