Class EnumConverters
- java.lang.Object
-
- org.eclipse.core.databinding.conversion.EnumConverters
-
public class EnumConverters extends java.lang.ObjectContains static methods the create converters for working withEnums.- Since:
- 1.11
-
-
Constructor Summary
Constructors Constructor Description EnumConverters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Enum<T>>
IConverter<java.lang.Integer,T>fromOrdinal(java.lang.Class<T> enumToType)Creates a converter which converts fromEnum.ordinals to enum values of the given type.static <T extends java.lang.Enum<T>>
IConverter<java.lang.String,T>fromString(java.lang.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 java.lang.Enum<T>>
IConverter<T,java.lang.Integer>toOrdinal(java.lang.Class<T> enumFromType)Creates a converter which converts fromEnum.ordinals to enum values of the given type.static <T extends java.lang.Enum<T>>
IConverter<T,java.lang.String>toString(java.lang.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 java.lang.Enum<T>> IConverter<java.lang.Integer,T> fromOrdinal(java.lang.Class<T> enumToType)
Creates a converter which converts fromEnum.ordinals 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 java.lang.Enum<T>> IConverter<java.lang.String,T> fromString(java.lang.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 java.lang.Enum<T>> IConverter<T,java.lang.Integer> toOrdinal(java.lang.Class<T> enumFromType)
Creates a converter which converts fromEnum.ordinals to enum values of the given type.nullin the converter input is converted tonull.- Parameters:
enumFromType- from type; not null- Returns:
- the created converter
-
toString
public static <T extends java.lang.Enum<T>> IConverter<T,java.lang.String> toString(java.lang.Class<T> enumFromType)
Creates a converter which converts to thetoString(java.lang.Class<T>)values of the enum constants.nullin the converter input is converted tonull.- Parameters:
enumFromType- from type; not null- Returns:
- the created converter
-
-