Class 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 Detail

      • ObjectDecoder

        public ObjectDecoder()
        constructor for the ObjectDecoder.
    • Method Detail

      • priority

        public Priority priority()
        Description copied from interface: Decoder
        Priority for the decoder. Allows us to sort encoders when we have multiple matches.
        Specified by:
        priority in interface Decoder<java.lang.Object>
        Returns:
        Priority
      • name

        public java.lang.String name()
        Description copied from interface: Decoder
        Name of the encoder.
        Specified by:
        name in interface Decoder<java.lang.Object>
        Returns:
        encoder name
      • canDecode

        public boolean canDecode​(java.lang.String path,
                                 Tags tags,
                                 ConfigNode node,
                                 TypeCapture<?> type)
        Description copied from interface: Decoder
        true if this decoder matches the type capture.
        Specified by:
        canDecode in interface Decoder<java.lang.Object>
        Parameters:
        path - the current path
        tags - the tags for the current request
        node - the current node we are decoding.
        type - the type of object we are decoding.
        Returns:
        true 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: Decoder
        Decode the current node. If the current node is a class or list we may need to decode sub nodes.
        Specified by:
        decode in interface Decoder<java.lang.Object>
        Parameters:
        path - the current path
        tags - the tags for the current request
        node - 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.