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 subschema selector for array instances

Its role is to select which subschemas apply to a given array index of an instance, given a digest built by ArraySchemaDigester.

It may happen that no schemas apply at all (in which case the document at the given array index will always validate successfully).

public final class ArraySchemaSelector
    private static final JsonPointer ITEMS = JsonPointer.of("items");
    private static final JsonPointer ADDITIONAL_ITEMS
        = JsonPointer.of("additionalItems");
    private final boolean hasItems;
    private final boolean itemsIsArray;
    private final int itemsSize;
    private final boolean hasAdditional;
    public ArraySchemaSelector(final JsonNode digest)
         = digest.get("hasItems").booleanValue();
         = digest.get("itemsIsArray").booleanValue();
         = digest.get("itemsSize").intValue();
         = digest.get("hasAdditional").booleanValue();
    public Iterable<JsonPointerselectSchemas(final int index)
        if (!)
                ? ImmutableList.of()
                : Collections.<JsonPointer>emptyList();
        if (!)
            return ImmutableList.of();
        if (index < )
            return ImmutableList.of(.append(index));
            ? ImmutableList.of()
            : Collections.<JsonPointer>emptyList();
New to GrepCode? Check out our FAQ X