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

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


                JSONSchemaBooleanType booleanType = (JSONSchemaBooleanType) type;
                if (defaultValue instanceof Boolean) {
                    booleanType.setDefaultValue((Boolean) defaultValue);
                }
            } else if (type instanceof JSONSchemaIntegerType) {
                JSONSchemaIntegerType intType = (JSONSchemaIntegerType) type;
                if (defaultValue instanceof Number) {
                    intType.setDefaultValue(((Number) defaultValue).intValue());
                }

                if (minimum instanceof Number) {
                    intType.setMinimum(minimum.intValue());
                }

                if (minimumExclusive instanceof Boolean) {
                    intType.setMinimumExclusive(minimumExclusive);
                }

                if (maximum instanceof Number) {
                    intType.setMaximum(maximum.intValue());
                }

                if (maximumExclusive instanceof Boolean) {
                    intType.setMaximumExclusive(maximumExclusive);
                }

                if (divisibleBy instanceof Number) {
                    intType.setDivisibleBy(divisibleBy.intValue());
                }

                intType.setEnumValues(Collections2.filter(Lists.transform(enums, new Function<Object, Integer>() {
                    @Override
                    public Integer apply(@Nullable Object input) {
                        return input instanceof Number ? ((Number) input).intValue() : null;
                    }
                }), Predicates.notNull()));
View Full Code Here


    public static JSONSchema newNumberSchema() {
        return newSimpleSchema(new JSONSchemaNumberType());
    }

    public static JSONSchema newIntegerSchema() {
        return newSimpleSchema(new JSONSchemaIntegerType());
    }
View Full Code Here

public final class JSONSchemaTypes {
    public static final JSONSchemaAnyType ANY = JSONSchemaAnyType.INSTANCE;
    public static final JSONSchemaNullType NULL = JSONSchemaNullType.INSTANCE;

    public static JSONSchemaIntegerType newNonNegativeInteger() {
        return new JSONSchemaIntegerType().minimum(0);
    }
View Full Code Here

    public static JSONSchemaIntegerType newNonNegativeInteger() {
        return new JSONSchemaIntegerType().minimum(0);
    }

    public static JSONSchemaIntegerType newPositiveInteger() {
        return new JSONSchemaIntegerType().minimum(0).minimumExclusive();
    }
View Full Code Here

                JSONSchemaBooleanType booleanType = (JSONSchemaBooleanType) type;
                if (defaultValue instanceof Boolean) {
                    booleanType.setDefaultValue((Boolean) defaultValue);
                }
            } else if (type instanceof JSONSchemaIntegerType) {
                JSONSchemaIntegerType intType = (JSONSchemaIntegerType) type;
                if (defaultValue instanceof Number) {
                    intType.setDefaultValue(((Number) defaultValue).intValue());
                }

                if (minimum instanceof Number) {
                    intType.setMinimum(minimum.intValue());
                }

                if (minimumExclusive instanceof Boolean) {
                    intType.setMinimumExclusive(minimumExclusive);
                }

                if (maximum instanceof Number) {
                    intType.setMaximum(maximum.intValue());
                }

                if (maximumExclusive instanceof Boolean) {
                    intType.setMaximumExclusive(maximumExclusive);
                }

                if (divisibleBy instanceof Number) {
                    intType.setDivisibleBy(divisibleBy.intValue());
                }

                intType.setEnumValues(Collections2.filter(Lists.transform(enums, new Function<Object, Integer>() {
                    @Override
                    public Integer apply(@Nullable Object input) {
                        return input instanceof Number ? ((Number) input).intValue() : null;
                    }
                }), Predicates.notNull()));
View Full Code Here

TOP

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

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.