-
- Type Parameters:
T- the generic type of the decoder.
- All Known Implementing Classes:
ArrayDecoder,BigDecimalDecoder,BigIntegerDecoder,BooleanDecoder,ByteDecoder,CharDecoder,CollectionDecoder,DateDecoder,DoubleDecoder,DurationDecoder,EnumDecoder,FileDecoder,FloatDecoder,InstantDecoder,IntegerDecoder,LeafDecoder,ListDecoder,LocalDateDecoder,LocalDateTimeDecoder,LongDecoder,MapDecoder,ObjectDecoder,OptionalDecoder,OptionalDoubleDecoder,OptionalIntDecoder,OptionalLongDecoder,PathDecoder,PatternDecoder,ProxyDecoder,RecordDecoder,SequencedCollectionDecoder,SequencedMapDecoder,SequencedSetDecoder,SetDecoder,ShortDecoder,StringConstructorDecoder,StringDecoder,UUIDDecoder
public interface Decoder<T>Interface for decoders so we can tell which classes this decoder supports and functionality to decode them.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidapplyConfig(GestaltConfig config)Apply the GestaltConfig to the Decoder.booleancanDecode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type)true if this decoder matches the type capture.GResultOf<T>decode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type, DecoderContext decoderContext)Decode the current node.java.lang.Stringname()Name of the encoder.Prioritypriority()Priority for the decoder.
-
-
-
Method Detail
-
priority
Priority priority()
Priority for the decoder. Allows us to sort encoders when we have multiple matches.- Returns:
- Priority
-
name
java.lang.String name()
Name of the encoder.- Returns:
- encoder name
-
applyConfig
default void applyConfig(GestaltConfig config)
Apply the GestaltConfig to the Decoder. Needed when building via the ServiceLoader It is a default method as most Decoders don't need to apply configs.- Parameters:
config- GestaltConfig to update the ConfigLoader
-
canDecode
boolean canDecode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type)true if this decoder matches the type capture.- Parameters:
path- the current pathtags- the tags for the current requestnode- the current node we are decoding.type- the type of object we are decoding.- Returns:
- true if this decoder matches the type capture
-
decode
GResultOf<T> decode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type, DecoderContext decoderContext)
Decode the current node. If the current node is a class or list we may need to decode sub nodes.- Parameters:
path- the current pathtags- the tags for the current requestnode- the current node we are decoding.type- the type of object we are decoding.decoderContext- The context of the current decoder.- Returns:
- GResultOf the current node with details of either success or failures.
-
-