- java.lang.Object
-
- org.github.gestalt.config.decoder.ProxyDecoder
-
- All Implemented Interfaces:
Decoder<java.lang.Object>
public final class ProxyDecoder extends java.lang.Object implements Decoder<java.lang.Object>
Allows a user to create an object from an interface and retrieve configuration values. Gestalt expects a standard java bean where the member value would be carModel then the method would be String getCarModel() If the interface has a default method and is missing a config, it will return the default value.
-
-
Constructor Summary
Constructors Constructor Description ProxyDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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<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()must have a higher priority than the object decoder.
-
-
-
Method Detail
-
applyConfig
public void applyConfig(GestaltConfig config)
Description copied from interface:DecoderApply 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.- Specified by:
applyConfigin interfaceDecoder<java.lang.Object>- Parameters:
config- GestaltConfig to update the ConfigLoader
-
priority
public Priority priority()
must have a higher priority than the object decoder.
-
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.
-
-