- java.lang.Object
-
- org.github.gestalt.config.decoder.ObjectDecoder
-
- All Implemented Interfaces:
Decoder<java.lang.Object>
public final class ObjectDecoder extends java.lang.Object implements Decoder<java.lang.Object>
Decode a class. This decoder is best suited for pojo style classes. Will fail if the constructor is private. Will construct the class even if there are missing values, the values will be null or the default. Then it will return errors. Decodes member classes and lists as well.
-
-
Constructor Summary
Constructors Constructor Description ObjectDecoder()constructor for the ObjectDecoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDecode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type)true if this decoder matches the type capture.GResultOf<java.lang.Object>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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.github.gestalt.config.decoder.Decoder
applyConfig
-
-
-
-
Method Detail
-
priority
public Priority priority()
Description copied from interface:DecoderPriority for the decoder. Allows us to sort encoders when we have multiple matches.
-
name
public java.lang.String name()
Description copied from interface:DecoderName of the encoder.
-
canDecode
public boolean canDecode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type)Description copied from interface:Decodertrue if this decoder matches the type capture.
-
decode
public GResultOf<java.lang.Object> decode(java.lang.String path, Tags tags, ConfigNode node, TypeCapture<?> type, DecoderContext decoderContext)
Description copied from interface:DecoderDecode the current node. If the current node is a class or list we may need to decode sub nodes.- Specified by:
decodein interfaceDecoder<java.lang.Object>- 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.
-
-