/** * Creates a new {@link Parser} using the given registry. The new Parser * clones all other configurations from this Parser. * * @throws IllegalArgumentException if a registry is already set. */ public Parser usingTypeRegistry(TypeRegistry registry) { if (this.registry != TypeRegistry.getEmptyTypeRegistry()) { throw new IllegalArgumentException("Only one registry is allowed."); } return new Parser(registry, ignoringUnknownFields, recursionLimit); }
Parser usingRecursionLimit(int recursionLimit) { return new Parser(registry, ignoringUnknownFields, recursionLimit); } }
/** * Creates a new {@link Parser} configured to not throw an exception when an unknown field is * encountered. The new Parser clones all other configurations from this Parser. */ public Parser ignoringUnknownFields() { return new Parser(this.registry, true, recursionLimit); }
/** * Creates a {@link Parser} with default configuration. */ public static Parser parser() { return new Parser(TypeRegistry.getEmptyTypeRegistry(), false, Parser.DEFAULT_RECURSION_LIMIT); }