Class ObjectParser<Value,​Context>

    • Constructor Detail

      • ObjectParser

        public ObjectParser​(String name)
        Creates a new ObjectParser instance with a name. This name is used to reference the parser in exceptions and messages.
      • ObjectParser

        public ObjectParser​(String name,
                            @Nullable
                            Supplier<Value> valueSupplier)
        Creates a new ObjectParser instance with a name.
        Parameters:
        name - the parsers name, used to reference the parser in exceptions and messages.
        valueSupplier - a supplier that creates a new Value instance used when the parser is used as an inner object parser.
      • ObjectParser

        public ObjectParser​(String name,
                            boolean ignoreUnknownFields,
                            @Nullable
                            Supplier<Value> valueSupplier)
        Creates a new ObjectParser instance with a name.
        Parameters:
        name - the parsers name, used to reference the parser in exceptions and messages.
        ignoreUnknownFields - Should this parser ignore unknown fields? This should generally be set to true only when parsing responses from external systems, never when parsing requests from users.
        valueSupplier - a supplier that creates a new Value instance used when the parser is used as an inner object parser.
      • ObjectParser

        public ObjectParser​(String name,
                            ObjectParser.UnknownFieldConsumer<Value> unknownFieldConsumer,
                            @Nullable
                            Supplier<Value> valueSupplier)
        Creates a new ObjectParser instance with a name.
        Parameters:
        name - the parsers name, used to reference the parser in exceptions and messages.
        unknownFieldConsumer - how to consume parsed unknown fields
        valueSupplier - a supplier that creates a new Value instance used when the parser is used as an inner object parser.