- java.lang.Object
-
- org.github.gestalt.config.decoder.LeafDecoder<java.util.Date>
-
- org.github.gestalt.config.decoder.DateDecoder
-
- All Implemented Interfaces:
Decoder<java.util.Date>
public final class DateDecoder extends LeafDecoder<java.util.Date>
Decode a date.
-
-
Constructor Summary
Constructors Constructor Description DateDecoder()Default date decoder using ISO_DATE_TIME.DateDecoder(java.lang.String formatter)Date decode that takes a formatter.
-
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.protected GResultOf<java.util.Date>leafDecode(java.lang.String path, ConfigNode node)Decode a leaf value.java.lang.Stringname()Name of the encoder.Prioritypriority()Priority for the decoder.-
Methods inherited from class org.github.gestalt.config.decoder.LeafDecoder
decode, leafDecode
-
-
-
-
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.- Parameters:
config- GestaltConfig to update the ConfigLoader
-
priority
public Priority priority()
Description copied from interface:DecoderPriority for the decoder. Allows us to sort encoders when we have multiple matches.- Returns:
- Priority
-
name
public java.lang.String name()
Description copied from interface:DecoderName of the encoder.- Returns:
- encoder name
-
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.- 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
-
leafDecode
protected GResultOf<java.util.Date> leafDecode(java.lang.String path, ConfigNode node)
Description copied from class:LeafDecoderDecode a leaf value.- Specified by:
leafDecodein classLeafDecoder<java.util.Date>- Parameters:
path- the current path.node- the current node we are decoding.- Returns:
- GResultOf the current node with details of either success or failures.
-
-