public class EnumConvertor<E extends Enum<E>> extends Object implements BiConvertor<String,E>
| Constructor and Description |
|---|
EnumConvertor(Class<E> targetType) |
EnumConvertor(Class<E> targetType,
String token) |
| Modifier and Type | Method and Description |
|---|---|
static String |
enum2Str(Enum<?> e)
pro.fessional.mirana.cast.EnumConvertorTest$Tx#ONE
|
static String |
enum2Str(Enum<?> e,
String spt) |
static <T extends Enum<T>> |
parseEnum(Class<T> clz,
String key)
parse enum by class and key
|
static <T extends Enum<T>> |
parseEnum(String clz,
String key)
parse enum by class and key
|
@NotNull Class<String> |
sourceType()
the source type
|
static <T extends Enum<T>> |
str2Enum(Class<T> enu,
String str) |
static <T extends Enum<T>> |
str2Enum(Class<T> enu,
String str,
String spt) |
static Enum<?> |
str2Enum(String str) |
static <T extends Enum<T>> |
str2Enum(String str,
String spt) |
@NotNull Class<E> |
targetType()
the target type
|
@Nullable String |
toSource(E e)
pro.fessional.mirana.cast.EnumConvertorTest$Tx#ONE
|
E |
toTarget(String s)
convert source to target
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanToSource, canToSource, canToTarget, canToTarget, compose, of, reverseBiConvertor, tryToSource, tryToSource, tryToTarget, tryToTargetpublic static final String SPLIT
@NotNull public @NotNull Class<String> sourceType()
BiConvertorsourceType in interface BiConvertor<String,E extends Enum<E>>@NotNull public @NotNull Class<E> targetType()
BiConvertortargetType in interface BiConvertor<String,E extends Enum<E>>@Nullable public E toTarget(String s)
BiConvertor@Nullable public @Nullable String toSource(E e)
@Contract(value="null->null;!null->!null") public static String enum2Str(Enum<?> e)
e - enum@Contract(value="null,_->null;!null,_->!null") public static String enum2Str(Enum<?> e, String spt)
public static <T extends Enum<T>> T parseEnum(String clz, String key)
T - Enum typeclz - full class name of enumkey - enum nameCopyright © 2024. All rights reserved.