Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2013, Francis Galiegue <>
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the Lesser GNU General Public License as
  * published by the Free Software Foundation, either version 3 of the
  * License, or (at your option) any later version.
  * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * Lesser GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <>.
package com.github.fge.jsonschema.processors.validation;
JSON Schema selector for member values of JSON Object instances

Unlike what happens with arrays, for a given member name of an instance, here there can be more than one subschema which the member value must be valid against.

public final class ObjectSchemaSelector
    private static final JsonPointer PROPERTIES
        = JsonPointer.of("properties");
    private static final JsonPointer PATTERNPROPERTIES
        = JsonPointer.of("patternProperties");
    private static final JsonPointer ADDITIONALPROPERTIES
        = JsonPointer.of("additionalProperties");
    private final List<Stringproperties;
    private final List<StringpatternProperties;
    private final boolean hasAdditional;
    public ObjectSchemaSelector(final JsonNode digest)
         = digest.get("hasAdditional").booleanValue();
        list = Lists.newArrayList();
        for (final JsonNode nodedigest.get("properties"))
         = ImmutableList.copyOf(list);
        list = Lists.newArrayList();
        for (final JsonNode nodedigest.get("patternProperties"))
         = ImmutableList.copyOf(list);
    public Iterable<JsonPointerselectSchemas(final String memberName)
        final List<JsonPointerlist = Lists.newArrayList();
        if (.contains(memberName))
        for (final String regex)
            if (RhinoHelper.regMatch(regexmemberName))
        if (!list.isEmpty())
            return ImmutableList.copyOf(list);
            ? ImmutableList.of()
            : Collections.<JsonPointer>emptyList();
New to GrepCode? Check out our FAQ X