Class CodecProperty.Adapter<T>
java.lang.Object
net.darkhax.pricklemc.common.impl.config.property.CodecProperty.Adapter<T>
- Type Parameters:
T- The type to adapt and serialize.
- All Implemented Interfaces:
IPropertyAdapter<CodecProperty<T>>
- Enclosing class:
CodecProperty<T>
public static class CodecProperty.Adapter<T>
extends Object
implements IPropertyAdapter<CodecProperty<T>>
A type adapter that will use a Codec to serialize a given type.
-
Method Summary
Modifier and TypeMethodDescription@Nullable CodecProperty<T> toValue(PropertyResolver resolver, Field field, Object parent, @Nullable Object value, Value valueMeta) Attempts to map a field on the config object to a config property.
-
Method Details
-
toValue
@Nullable public @Nullable CodecProperty<T> toValue(PropertyResolver resolver, Field field, Object parent, @Nullable @Nullable Object value, Value valueMeta) throws IOException Description copied from interface:IPropertyAdapterAttempts to map a field on the config object to a config property. If the field is not adaptable null should be returned.- Specified by:
toValuein interfaceIPropertyAdapter<T>- Parameters:
resolver- Resolves other config properties and JSON values using the options provided when the ConfigManager is built.field- The field being mapped.parent- The parent object that holds the field.value- The current value of the field.valueMeta- Metadata related to the config value.- Returns:
- If the field can be mapped to a property it will be returned, otherwise null.
- Throws:
IOException- Errors may occur when trying to map the field to a property.
-