Class EnumFormatter<E extends java.lang.Enum<E>>
- java.lang.Object
-
- aQute.bnd.build.model.conversions.EnumFormatter<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
Converter<java.lang.String,E>
public class EnumFormatter<E extends java.lang.Enum<E>> extends java.lang.Object implements Converter<java.lang.String,E>
Formats an enum type. Outputsnull
when the value of the enum is equal to a default value.- Author:
- Neil Bartlett
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
convert(E input)
static <E extends java.lang.Enum<E>>
EnumFormatter<E>create(java.lang.Class<E> enumType)
Construct a new formatter with no default value, i.e.static <E extends java.lang.Enum<E>>
EnumFormatter<E>create(java.lang.Class<E> enumType, E defaultValue)
Construct a new formatter with the specified default value.java.lang.String
error(java.lang.String msg)
-
-
-
Method Detail
-
create
public static <E extends java.lang.Enum<E>> EnumFormatter<E> create(java.lang.Class<E> enumType)
Construct a new formatter with no default value, i.e. any non-null value of the enum will print that value.- Parameters:
enumType
- The enum type.
-
create
public static <E extends java.lang.Enum<E>> EnumFormatter<E> create(java.lang.Class<E> enumType, E defaultValue)
Construct a new formatter with the specified default value.- Parameters:
enumType
- The enum type.defaultValue
- The default value, which will never be output.
-
convert
public java.lang.String convert(E input) throws java.lang.IllegalArgumentException
-
-