Class EnumConverters
java.lang.Object
org.eclipse.core.databinding.conversion.EnumConverters
Contains static methods the create converters for working with
Enum
s.- Since:
- 1.11
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T>>
IConverter<Integer,T> fromOrdinal
(Class<T> enumToType) Creates a converter which converts fromEnum.ordinal
s to enum values of the given type.static <T extends Enum<T>>
IConverter<String,T> fromString
(Class<T> enumToType) Creates a converter which converts from thetoString(java.lang.Class<T>)
values of enums values to enum values themselves.static <T extends Enum<T>>
IConverter<T,Integer> Creates a converter which converts fromEnum.ordinal
s to enum values of the given type.static <T extends Enum<T>>
IConverter<T,String> Creates a converter which converts to thetoString(java.lang.Class<T>)
values of the enum constants.
-
Constructor Details
-
EnumConverters
public EnumConverters()
-
-
Method Details
-
fromOrdinal
Creates a converter which converts fromEnum.ordinal
s to enum values of the given type. Invalid ordinal values are converted tonull
.- Parameters:
enumToType
- to type; not null- Returns:
- the created converter
-
fromString
Creates a converter which converts from thetoString(java.lang.Class<T>)
values of enums values to enum values themselves. Invalid string values are converted tonull
.- Parameters:
enumToType
- to type; not null- Returns:
- the created converter
-
toOrdinal
Creates a converter which converts fromEnum.ordinal
s to enum values of the given type.null
in the converter input is converted tonull
.- Parameters:
enumFromType
- from type; not null- Returns:
- the created converter
-
toString
Creates a converter which converts to thetoString(java.lang.Class<T>)
values of the enum constants.null
in the converter input is converted tonull
.- Parameters:
enumFromType
- from type; not null- Returns:
- the created converter
-