com.dimajix.shaded.everit.schema.EnumSchema Maven / Gradle / Ivy
package com.dimajix.shaded.everit.schema;
import static java.util.stream.Collectors.toList;
import static com.dimajix.shaded.everit.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 com.dimajix.shaded.everit.schema.loader.OrgJsonUtil;
import com.dimajix.shaded.json.JSONArray;
import com.dimajix.shaded.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