- java.lang.Object
-
- org.github.gestalt.config.decoder.DecoderRegistry
-
- All Implemented Interfaces:
DecoderService
public final class DecoderRegistry extends java.lang.Object implements DecoderService
Contains all decoders and functionality interact and decode a node.
-
-
Constructor Summary
Constructors Constructor Description DecoderRegistry(java.util.List<Decoder<?>> decoders, ConfigNodeService configNodeService, SentenceLexer lexer, java.util.List<PathMapper> pathMappers)Constructor to build Decoder Registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDecoders(java.util.List<Decoder<?>> addDecoders)Add decoders to the service.<T> GResultOf<T>decodeNode(java.lang.String path, Tags tags, java.lang.String configNode, TypeCapture<T> klass, DecoderContext decoderContext)Decode a node and return the GResultOf with the results.<T> GResultOf<T>decodeNode(java.lang.String path, Tags tags, ConfigNode configNode, TypeCapture<T> klass, DecoderContext decoderContext)Decode a node and return the GResultOf with the results.java.util.List<Decoder<?>>getDecoders()Get a list of decoders supported.GResultOf<ConfigNode>getNextNode(java.lang.String path, int nextIndex, ConfigNode configNode)Gets the next node from a config node, in a path for a int index.GResultOf<ConfigNode>getNextNode(java.lang.String path, java.lang.String nextPath, ConfigNode configNode)Gets the next node from a config node, in a path for a string.java.util.List<PathMapper>getPathMappers()Get all path mappers the decoder service has registered.voidsetDecoders(java.util.List<Decoder<?>> decoders)Set a list of decoders, replaces any existing decoders.voidsetPathMappers(java.util.List<PathMapper> pathMappers)Set all path mappers the decoder service can use.
-
-
-
Constructor Detail
-
DecoderRegistry
public DecoderRegistry(java.util.List<Decoder<?>> decoders, ConfigNodeService configNodeService, SentenceLexer lexer, java.util.List<PathMapper> pathMappers) throws GestaltConfigurationException
Constructor to build Decoder Registry.- Parameters:
decoders- list of all supported decodersconfigNodeService- config node service that holds the config nodes.lexer- sentence lexer to decodepathMappers- path mappers to test- Throws:
GestaltConfigurationException- any configuration exceptions for empty parameters.
-
-
Method Detail
-
addDecoders
public void addDecoders(java.util.List<Decoder<?>> addDecoders)
Description copied from interface:DecoderServiceAdd decoders to the service.- Specified by:
addDecodersin interfaceDecoderService- Parameters:
addDecoders- list of decoders
-
getDecoders
public java.util.List<Decoder<?>> getDecoders()
Description copied from interface:DecoderServiceGet a list of decoders supported.- Specified by:
getDecodersin interfaceDecoderService- Returns:
- ist of decoders supported
-
setDecoders
public void setDecoders(java.util.List<Decoder<?>> decoders)
Description copied from interface:DecoderServiceSet a list of decoders, replaces any existing decoders.- Specified by:
setDecodersin interfaceDecoderService- Parameters:
decoders- list of decoders
-
getPathMappers
public java.util.List<PathMapper> getPathMappers()
Description copied from interface:DecoderServiceGet all path mappers the decoder service has registered.- Specified by:
getPathMappersin interfaceDecoderService- Returns:
- PathMapper
-
setPathMappers
public void setPathMappers(java.util.List<PathMapper> pathMappers)
Description copied from interface:DecoderServiceSet all path mappers the decoder service can use.- Specified by:
setPathMappersin interfaceDecoderService- Parameters:
pathMappers- path mappers to replace the current ones
-
decodeNode
public <T> GResultOf<T> decodeNode(java.lang.String path, Tags tags, java.lang.String configNode, TypeCapture<T> klass, DecoderContext decoderContext)
Description copied from interface:DecoderServiceDecode a node and return the GResultOf with the results.- Specified by:
decodeNodein interfaceDecoderService- Type Parameters:
T- The generic type of the node we are decoding.- Parameters:
path- Current path we are decoding, used for loggingtags- the tags for the current requestconfigNode- the current node we are decodingklass- the TypeCapture of the node we are decodingdecoderContext- The context for the decoder- Returns:
- GResultOf the code we are decoding.
-
decodeNode
public <T> GResultOf<T> decodeNode(java.lang.String path, Tags tags, ConfigNode configNode, TypeCapture<T> klass, DecoderContext decoderContext)
Description copied from interface:DecoderServiceDecode a node and return the GResultOf with the results.- Specified by:
decodeNodein interfaceDecoderService- Type Parameters:
T- The generic type of the node we are decoding.- Parameters:
path- Current path we are decoding, used for loggingtags- the tags for the current requestconfigNode- the current node we are decodingklass- the TypeCapture of the node we are decodingdecoderContext- The context for the decoder- Returns:
- GResultOf the code we are decoding.
-
getNextNode
public GResultOf<ConfigNode> getNextNode(java.lang.String path, java.lang.String nextPath, ConfigNode configNode)
Description copied from interface:DecoderServiceGets the next node from a config node, in a path for a string.- Specified by:
getNextNodein interfaceDecoderService- Parameters:
path- Current path we are decoding, used for loggingnextPath- path of the next nodeconfigNode- current config node- Returns:
- the next config node.
-
getNextNode
public GResultOf<ConfigNode> getNextNode(java.lang.String path, int nextIndex, ConfigNode configNode)
Description copied from interface:DecoderServiceGets the next node from a config node, in a path for a int index.- Specified by:
getNextNodein interfaceDecoderService- Parameters:
path- Current path we are decoding, used for loggingnextIndex- path of the next nodeconfigNode- current config node- Returns:
- the next config node.
-
-