org.everit.json.schema.EnumSchema Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of everit-json-schema Show documentation
Show all versions of everit-json-schema Show documentation
Implementation of the JSON Schema Core Draft v4 specification built with the org.json API
package org.everit.json.schema;
import static java.util.stream.Collectors.toList;
import static org.everit.json.schema.loader.OrgJsonUtil.toMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.everit.json.schema.loader.OrgJsonUtil;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* Enum schema validator.
*/
public class EnumSchema extends Schema {
static Object toJavaValue(Object orig) {
if (orig instanceof JSONArray) {
return OrgJsonUtil.toList((JSONArray) orig);
} else if (orig instanceof JSONObject) {
return toMap((JSONObject) orig);
} else if (orig == JSONObject.NULL) {
return null;
} else {
return orig;
}
}
static List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy