Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Latest commit

 

History

History
85 lines (68 loc) · 3.53 KB

File metadata and controls

85 lines (68 loc) · 3.53 KB

IntegerMax10

org.openapijsonschematools.client.components.schemas.IntegerMax10.java public class IntegerMax10

A class that contains necessary nested

  • schema classes (which validate payloads), extends JsonSchema
  • sealed interfaces which store validated payloads, java version of a sum type
  • boxed classes which store validated payloads, sealed permits class implementations

Nested Class Summary

Modifier and Type Class and Description
sealed interface IntegerMax10.IntegerMax101Boxed
sealed interface for validated payloads
record IntegerMax10.IntegerMax101BoxedNumber
boxed class to store validated Number payloads
static class IntegerMax10.IntegerMax101
schema class

IntegerMax101Boxed

public sealed interface IntegerMax101Boxed
permits
IntegerMax101BoxedNumber

sealed interface that stores validated payloads using boxed classes

IntegerMax101BoxedNumber

public record IntegerMax101BoxedNumber
implements IntegerMax101Boxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

Constructor and Description
IntegerMax101BoxedNumber(Number data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
Number data()
validated payload
@Nullable Object getData()
validated payload

IntegerMax101

public static class IntegerMax101
extends JsonSchema

A schema class that validates payloads

Code Sample

import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
import org.openapijsonschematools.client.exceptions.ValidationException;
import org.openapijsonschematools.client.schemas.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import org.openapijsonschematools.client.components.schemas.IntegerMax10;

import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// long validation
long validatedPayload = IntegerMax10.IntegerMax101.validate(
    1L,
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
String type = "int64";
Number maximum = 10

Method Summary

Modifier and Type Method and Description
long validate(long arg, SchemaConfiguration configuration)
IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration)
IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

[Back to top] [Back to Component Schemas] [Back to README]