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

Latest commit

 

History

History
217 lines (171 loc) · 8.65 KB

File metadata and controls

217 lines (171 loc) · 8.65 KB

ComposedNumber

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

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 ComposedNumber.ComposedNumber1Boxed
sealed interface for validated payloads
record ComposedNumber.ComposedNumber1BoxedNumber
boxed class to store validated Number payloads
static class ComposedNumber.ComposedNumber1
schema class
sealed interface ComposedNumber.Schema0Boxed
sealed interface for validated payloads
record ComposedNumber.Schema0BoxedVoid
boxed class to store validated null payloads
record ComposedNumber.Schema0BoxedBoolean
boxed class to store validated boolean payloads
record ComposedNumber.Schema0BoxedNumber
boxed class to store validated Number payloads
record ComposedNumber.Schema0BoxedString
boxed class to store validated String payloads
record ComposedNumber.Schema0BoxedList
boxed class to store validated List payloads
record ComposedNumber.Schema0BoxedMap
boxed class to store validated Map payloads
static class ComposedNumber.Schema0
schema class

ComposedNumber1Boxed

public sealed interface ComposedNumber1Boxed
permits
ComposedNumber1BoxedNumber

sealed interface that stores validated payloads using boxed classes

ComposedNumber1BoxedNumber

public record ComposedNumber1BoxedNumber
implements ComposedNumber1Boxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

ComposedNumber1

public static class ComposedNumber1
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.ComposedNumber;

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

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

// int validation
int validatedPayload = ComposedNumber.ComposedNumber1.validate(
    1,
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    Integer.class,
    Long.class,
    Float.class,
    Double.class
)
List<Class<? extends JsonSchema>> allOf = List.of(
    Schema0.class
;)

Method Summary

Modifier and Type Method and Description
Number validate(Number arg, SchemaConfiguration configuration)
ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration)
ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

Schema0Boxed

public sealed interface Schema0Boxed
permits
Schema0BoxedVoid, Schema0BoxedBoolean, Schema0BoxedNumber, Schema0BoxedString, Schema0BoxedList, Schema0BoxedMap

sealed interface that stores validated payloads using boxed classes

Schema0BoxedVoid

public record Schema0BoxedVoid
implements Schema0Boxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Schema0BoxedVoid(Void data)
Creates an instance, private visibility

Method Summary

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

Schema0BoxedBoolean

public record Schema0BoxedBoolean
implements Schema0Boxed

record that stores validated boolean payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility

Method Summary

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

Schema0BoxedNumber

public record Schema0BoxedNumber
implements Schema0Boxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Schema0BoxedString

public record Schema0BoxedString
implements Schema0Boxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Schema0BoxedString(String data)
Creates an instance, private visibility

Method Summary

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

Schema0BoxedList

public record Schema0BoxedList
implements Schema0Boxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Schema0BoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenList<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

Schema0BoxedMap

public record Schema0BoxedMap
implements Schema0Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Schema0BoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenMap<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

Schema0

public static class Schema0
extends AnyTypeJsonSchema.AnyTypeJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1
validate
validateAndBox

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