com.dimajix.shaded.everit.schema.loader.JsonValue Maven / Gradle / Ivy
package com.dimajix.shaded.everit.schema.loader;
import static com.dimajix.shaded.everit.schema.loader.OrgJsonUtil.toList;
import static com.dimajix.shaded.everit.schema.loader.OrgJsonUtil.toMap;
import static com.dimajix.shaded.everit.schema.loader.SpecificationVersion.DRAFT_4;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import com.dimajix.shaded.everit.schema.SchemaException;
import com.dimajix.shaded.json.JSONArray;
import com.dimajix.shaded.json.JSONObject;
/**
* @author erosb
*/
class JsonValue {
class Multiplexer {
protected Map, Function, R>> actions = new HashMap<>();
Multiplexer(Class> expectedType, Function, R> mapper) {
actions.put(expectedType, mapper);
}
Multiplexer orMappedTo(Class expectedType, Function mapper) {
actions.put(expectedType, mapper);
return this;
}
R requireAny() {
if (typeOfValue() == null) {
throw multiplexFailure();
}
Function
© 2015 - 2024 Weber Informatics LLC | Privacy Policy