Package com.install4j.api.beaninfo
Interface EnumerationMapper
-
public interface EnumerationMapper
Interface for mapping values and descriptions of enumerated properties. Instances of this class can be registered withInstall4JBeanInfo.setEnumerationMappers(EnumerationMapper[])
. In the install4j GUI, an enumerated property will be displayed with the enumeration entry name that corresponds to the object value of the property and the user can choose a value from a drop-down list.This class is not needed for displaying java enums, which are automatically presented with a drop-down list, displaying the result of the invocation of their
toString()
methods.In concept, this class is similar to the
PropertyConverter
class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_CONTEXT
A default context that you can use in thegetContext()
method if there is only one enumeration mapper for the property type returned bygetEnumerationClass()
}
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getContext()
The property descriptor of an enumerated property must have a non-null context that corresponds to the return value of this method.java.lang.Class
getEnumerationClass()
Return the property type for which this enumeration mapper is eligible.EnumerationMapEntry[]
getEnumerationMapEntries()
Defines the enumeration.
-
-
-
Field Detail
-
DEFAULT_CONTEXT
static final java.lang.String DEFAULT_CONTEXT
A default context that you can use in thegetContext()
method if there is only one enumeration mapper for the property type returned bygetEnumerationClass()
}- See Also:
- Constant Field Values
-
-
Method Detail
-
getEnumerationClass
java.lang.Class getEnumerationClass()
Return the property type for which this enumeration mapper is eligible. The objects in the @{EnumerationMapEntry} returned bygetEnumerationMapEntries()
must be of this type.- Returns:
- the class of the enumerated property
-
getEnumerationMapEntries
EnumerationMapEntry[] getEnumerationMapEntries()
Defines the enumeration.- Returns:
- the enumeration map entries
-
getContext
java.lang.String getContext()
The property descriptor of an enumerated property must have a non-null context that corresponds to the return value of this method. In this way the runtime knows that this enumeration mapper should be used for displaying and editing properties. The context must not be globally unique, enumeration mappers of other property types can use the same context value.For classes that do not have default handlers in install4j, the enumeration mapper will also be used if this method returns
DEFAULT_CONTEXT
, thegetEnumerationClass()
method returns the class of the property and the context of the property is not set. However, it is safer not to rely on that behavior.- Returns:
- the context that will be used by the enumerated properties
-
-