Class 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 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 decoders
        configNodeService - config node service that holds the config nodes.
        lexer - sentence lexer to decode
        pathMappers - 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: DecoderService
        Add decoders to the service.
        Specified by:
        addDecoders in interface DecoderService
        Parameters:
        addDecoders - list of decoders
      • getDecoders

        public java.util.List<Decoder<?>> getDecoders()
        Description copied from interface: DecoderService
        Get a list of decoders supported.
        Specified by:
        getDecoders in interface DecoderService
        Returns:
        ist of decoders supported
      • setDecoders

        public void setDecoders​(java.util.List<Decoder<?>> decoders)
        Description copied from interface: DecoderService
        Set a list of decoders, replaces any existing decoders.
        Specified by:
        setDecoders in interface DecoderService
        Parameters:
        decoders - list of decoders
      • setPathMappers

        public void setPathMappers​(java.util.List<PathMapper> pathMappers)
        Description copied from interface: DecoderService
        Set all path mappers the decoder service can use.
        Specified by:
        setPathMappers in interface DecoderService
        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: DecoderService
        Decode a node and return the GResultOf with the results.
        Specified by:
        decodeNode in interface DecoderService
        Type Parameters:
        T - The generic type of the node we are decoding.
        Parameters:
        path - Current path we are decoding, used for logging
        tags - the tags for the current request
        configNode - the current node we are decoding
        klass - the TypeCapture of the node we are decoding
        decoderContext - 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: DecoderService
        Decode a node and return the GResultOf with the results.
        Specified by:
        decodeNode in interface DecoderService
        Type Parameters:
        T - The generic type of the node we are decoding.
        Parameters:
        path - Current path we are decoding, used for logging
        tags - the tags for the current request
        configNode - the current node we are decoding
        klass - the TypeCapture of the node we are decoding
        decoderContext - 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: DecoderService
        Gets the next node from a config node, in a path for a string.
        Specified by:
        getNextNode in interface DecoderService
        Parameters:
        path - Current path we are decoding, used for logging
        nextPath - path of the next node
        configNode - 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: DecoderService
        Gets the next node from a config node, in a path for a int index.
        Specified by:
        getNextNode in interface DecoderService
        Parameters:
        path - Current path we are decoding, used for logging
        nextIndex - path of the next node
        configNode - current config node
        Returns:
        the next config node.