This commit is contained in:
@@ -22,8 +22,6 @@ import org.redkale.convert.Writer;
|
|||||||
*/
|
*/
|
||||||
public final class EnumSimpledCoder<R extends Reader, W extends Writer, E extends Enum> extends SimpledCoder<R, W, E> {
|
public final class EnumSimpledCoder<R extends Reader, W extends Writer, E extends Enum> extends SimpledCoder<R, W, E> {
|
||||||
|
|
||||||
private final Class<E> type;
|
|
||||||
|
|
||||||
public EnumSimpledCoder(Class<E> type) {
|
public EnumSimpledCoder(Class<E> type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
@@ -42,11 +40,11 @@ public final class EnumSimpledCoder<R extends Reader, W extends Writer, E extend
|
|||||||
public E convertFrom(final R in) {
|
public E convertFrom(final R in) {
|
||||||
String value = in.readSmallString();
|
String value = in.readSmallString();
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
return (E) Enum.valueOf(type, value);
|
return (E) Enum.valueOf((Class<E>) type, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<E> getType() {
|
public Class<E> getType() {
|
||||||
return type;
|
return (Class<E>) type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user