Class EnumConverters
- java.lang.Object
-
- org.eclipse.core.databinding.conversion.EnumConverters
-
-
Constructor Summary
Constructors Constructor Description EnumConverters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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>toOrdinal(Class<T> enumFromType)
Creates a converter which converts fromEnum.ordinal
s to enum values of the given type.static <T extends Enum<T>>
IConverter<T,String>toString(Class<T> enumFromType)
Creates a converter which converts to thetoString(java.lang.Class<T>)
values of the enum constants.
-
-
-
Method Detail
-
fromOrdinal
public static <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. Invalid ordinal values are converted tonull
.- Parameters:
enumToType
- to type; not null- Returns:
- the created converter
-
fromString
public 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. Invalid string values are converted tonull
.- Parameters:
enumToType
- to type; not null- Returns:
- the created converter
-
toOrdinal
public static <T extends Enum<T>> IConverter<T,Integer> toOrdinal(Class<T> enumFromType)
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
public static <T extends Enum<T>> IConverter<T,String> toString(Class<T> enumFromType)
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
-
-