Class ValueAdapter<TYPE>
- java.lang.Object
-
- cc.carm.lib.configuration.adapter.ValueAdapter<TYPE>
-
- Type Parameters:
TYPE- The type of the target value
- All Implemented Interfaces:
ValueParser<TYPE>,ValueSerializer<TYPE>
- Direct Known Subclasses:
PrimitiveAdapter
public class ValueAdapter<TYPE> extends java.lang.Object implements ValueSerializer<TYPE>, ValueParser<TYPE>
Value adapter, used to convert the value of the configuration file into the objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected @Nullable ValueParser<TYPE>deserializerprotected @Nullable ValueSerializer<TYPE>serializerprotected @NotNull ValueType<TYPE>type
-
Constructor Summary
Constructors Constructor Description ValueAdapter(@NotNull ValueType<TYPE> type)ValueAdapter(@NotNull ValueType<TYPE> type, @Nullable ValueSerializer<TYPE> serializer, @Nullable ValueParser<TYPE> parser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()TYPEparse(@NotNull ConfigurationHolder<?> holder, @NotNull ValueType<? super TYPE> type, @NotNull java.lang.Object value)@Nullable ValueParser<TYPE>parser()ValueAdapter<TYPE>parser(@Nullable ValueParser<TYPE> deserializer)java.lang.Objectserialize(@NotNull ConfigurationHolder<?> holder, @NotNull ValueType<? super TYPE> type, TYPE value)@Nullable ValueSerializer<TYPE>serializer()ValueAdapter<TYPE>serializer(@Nullable ValueSerializer<TYPE> serializer)@NotNull ValueType<TYPE>type()
-
-
-
Field Detail
-
serializer
@Nullable protected @Nullable ValueSerializer<TYPE> serializer
-
deserializer
@Nullable protected @Nullable ValueParser<TYPE> deserializer
-
-
Constructor Detail
-
ValueAdapter
public ValueAdapter(@NotNull @NotNull ValueType<TYPE> type, @Nullable @Nullable ValueSerializer<TYPE> serializer, @Nullable @Nullable ValueParser<TYPE> parser)
-
-
Method Detail
-
serializer
@Nullable public @Nullable ValueSerializer<TYPE> serializer()
-
parser
@Nullable public @Nullable ValueParser<TYPE> parser()
-
serializer
public ValueAdapter<TYPE> serializer(@Nullable @Nullable ValueSerializer<TYPE> serializer)
-
parser
public ValueAdapter<TYPE> parser(@Nullable @Nullable ValueParser<TYPE> deserializer)
-
serialize
public java.lang.Object serialize(@NotNull @NotNull ConfigurationHolder<?> holder, @NotNull @NotNull ValueType<? super TYPE> type, @NotNull TYPE value) throws java.lang.Exception- Specified by:
serializein interfaceValueSerializer<TYPE>- Throws:
java.lang.Exception
-
parse
public TYPE parse(@NotNull @NotNull ConfigurationHolder<?> holder, @NotNull @NotNull ValueType<? super TYPE> type, @NotNull @NotNull java.lang.Object value) throws java.lang.Exception
- Specified by:
parsein interfaceValueParser<TYPE>- Throws:
java.lang.Exception
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-