Java Code Examples for org.everit.json.schema.NumberSchema#Builder

The following examples show how to use org.everit.json.schema.NumberSchema#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaExtractor.java    From json-schema with Apache License 2.0 5 votes vote down vote up
NumberSchema.Builder buildNumberSchema() {
    PropertySnifferSchemaExtractor.NUMBER_SCHEMA_PROPS.forEach(consumedKeys::keyConsumed);
    NumberSchema.Builder builder = NumberSchema.builder();
    maybe("minimum").map(JsonValue::requireNumber).ifPresent(builder::minimum);
    maybe("maximum").map(JsonValue::requireNumber).ifPresent(builder::maximum);
    maybe("multipleOf").map(JsonValue::requireNumber).ifPresent(builder::multipleOf);
    maybe("exclusiveMinimum").ifPresent(exclMin -> exclusiveLimitHandler.handleExclusiveMinimum(exclMin, builder));
    maybe("exclusiveMaximum").ifPresent(exclMax -> exclusiveLimitHandler.handleExclusiveMaximum(exclMax, builder));
    return builder;
}
 
Example 2
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 4 votes vote down vote up
@Override
public void handleExclusiveMinimum(JsonValue exclMinimum, NumberSchema.Builder schemaBuilder) {
    schemaBuilder.exclusiveMinimum(exclMinimum.requireBoolean());
}
 
Example 3
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 4 votes vote down vote up
@Override
public void handleExclusiveMaximum(JsonValue exclMaximum, NumberSchema.Builder schemaBuilder) {
    schemaBuilder.exclusiveMaximum(exclMaximum.requireBoolean());
}
 
Example 4
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 4 votes vote down vote up
@Override
public void handleExclusiveMinimum(JsonValue exclMinimum, NumberSchema.Builder schemaBuilder) {
    schemaBuilder.exclusiveMinimum(exclMinimum.requireNumber());
}
 
Example 5
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 4 votes vote down vote up
@Override
public void handleExclusiveMaximum(JsonValue exclMaximum, NumberSchema.Builder schemaBuilder) {
    schemaBuilder.exclusiveMaximum(exclMaximum.requireNumber());
}
 
Example 6
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 votes vote down vote up
void handleExclusiveMinimum(JsonValue exclMinimum, NumberSchema.Builder schemaBuilder); 
Example 7
Source File: ExclusiveLimitHandler.java    From json-schema with Apache License 2.0 votes vote down vote up
void handleExclusiveMaximum(JsonValue exclMaximum, NumberSchema.Builder schemaBuilder);