Package com.bazaarvoice.commons.data.model.json.schema.types

Examples of com.bazaarvoice.commons.data.model.json.schema.types.JSONSchemaUnionType


    private Collection<Object> convertSchemaTypesToJSONValues(Collection<JSONSchemaType<?>> types) {
        List<Object> typeValues = Lists.newArrayList();
        for (final JSONSchemaType<?> type : types) {
            if (type instanceof JSONSchemaUnionType) {
                JSONSchemaUnionType unionType = (JSONSchemaUnionType) type;
                typeValues.addAll(toJSONList(unionType.getSchemas(), false));
            } else {
                typeValues.add(convertSchemaTypeToJSONTypeValue(type));
            }
        }
        return typeValues;
View Full Code Here


        return typeValues;
    }

    private Collection<JSONSchemaType<?>> convertSchemaTypesFromJSONValues(Collection<Object> jsonValues) {
        List<JSONSchemaType<?>> types = Lists.newArrayList();
        JSONSchemaUnionType unionType = null;
        for (Object jsonValue : jsonValues) {
            if (jsonValue instanceof JSONObject) {
                if (unionType == null) {
                    unionType = new JSONSchemaUnionType();
                    types.add(unionType);
                }

                unionType.addSchema(fromJSONObject((JSONObject) jsonValue));
            } else {
                types.add(convertSchemaTypeFromJSONTypeValue(jsonValue.toString()));
            }
        }
        return types;
View Full Code Here

    public static JSONSchema newNullSchema() {
        return newSimpleSchema(JSONSchemaTypes.NULL);
    }

    public static JSONSchema newUnionSchema(JSONSchema... schemas) {
        return newSimpleSchema(new JSONSchemaUnionType().schemas(schemas));
    }
View Full Code Here

    private Collection<Object> convertSchemaTypesToJSONValues(Collection<JSONSchemaType<?>> types) {
        List<Object> typeValues = Lists.newArrayList();
        for (final JSONSchemaType<?> type : types) {
            if (type instanceof JSONSchemaUnionType) {
                JSONSchemaUnionType unionType = (JSONSchemaUnionType) type;
                typeValues.addAll(toJSONList(unionType.getSchemas(), false));
            } else {
                typeValues.add(convertSchemaTypeToJSONTypeValue(type));
            }
        }
        return typeValues;
View Full Code Here

        return typeValues;
    }

    private Collection<JSONSchemaType<?>> convertSchemaTypesFromJSONValues(Collection<Object> jsonValues) {
        List<JSONSchemaType<?>> types = Lists.newArrayList();
        JSONSchemaUnionType unionType = null;
        for (Object jsonValue : jsonValues) {
            if (jsonValue instanceof JSONObject) {
                if (unionType == null) {
                    unionType = new JSONSchemaUnionType();
                    types.add(unionType);
                }

                unionType.addSchema(fromJSONObject((JSONObject) jsonValue));
            } else {
                types.add(convertSchemaTypeFromJSONTypeValue(jsonValue.toString()));
            }
        }
        return types;
View Full Code Here

    protected Collection<Object> convertSchemaTypesToJSONValues(Collection<JSONSchemaType<?>> types) {
        List<Object> typeValues = Lists.newArrayList();
        for (final JSONSchemaType<?> type : types) {
            if (type instanceof JSONSchemaUnionType) {
                JSONSchemaUnionType unionType = (JSONSchemaUnionType) type;
                typeValues.addAll(toJSONList(unionType.getSchemas(), false));
            } else {
                typeValues.add(convertSchemaTypeToJSONTypeValue(type));
            }
        }
        return typeValues;
View Full Code Here

        return typeValues;
    }

    protected Collection<JSONSchemaType<?>> convertSchemaTypesFromJSONValues(JSONObject jsonObject, Collection<Object> jsonValues) {
        List<JSONSchemaType<?>> types = Lists.newArrayList();
        JSONSchemaUnionType unionType = null;
        for (Object jsonValue : jsonValues) {
            if (jsonValue instanceof JSONObject) {
                if (unionType == null) {
                    unionType = new JSONSchemaUnionType();
                    types.add(unionType);
                }

                unionType.addSchema(fromJSONObject((JSONObject) jsonValue));
            } else {
                types.add(convertSchemaTypeFromJSONTypeValue(jsonObject, jsonValue.toString()));
            }
        }
        return types;
View Full Code Here

TOP

Related Classes of com.bazaarvoice.commons.data.model.json.schema.types.JSONSchemaUnionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.