Skip to content

Latest commit

 

History

History
143 lines (114 loc) · 6.1 KB

File metadata and controls

143 lines (114 loc) · 6.1 KB

IntegerEnumWithDefaultValue

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

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
  • enum classes

Nested Class Summary

Modifier and Type Class and Description
sealed interface IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1Boxed
sealed interface for validated payloads
record IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1BoxedNumber
boxed class to store validated Number payloads
static class IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1
schema class
enum IntegerEnumWithDefaultValue.IntegerIntegerEnumWithDefaultValueEnums
Integer enum
enum IntegerEnumWithDefaultValue.LongIntegerEnumWithDefaultValueEnums
Long enum
enum IntegerEnumWithDefaultValue.FloatIntegerEnumWithDefaultValueEnums
Float enum
enum IntegerEnumWithDefaultValue.DoubleIntegerEnumWithDefaultValueEnums
Double enum

IntegerEnumWithDefaultValue1Boxed

public sealed interface IntegerEnumWithDefaultValue1Boxed
permits
IntegerEnumWithDefaultValue1BoxedNumber

sealed interface that stores validated payloads using boxed classes

IntegerEnumWithDefaultValue1BoxedNumber

public record IntegerEnumWithDefaultValue1BoxedNumber
implements IntegerEnumWithDefaultValue1Boxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

IntegerEnumWithDefaultValue1

public static class IntegerEnumWithDefaultValue1
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.IntegerEnumWithDefaultValue;

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 = IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.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 = "int";
Set enumValues = SetMaker.makeSet(
    0,
    1,
    2
)
@Nullable Object defaultValue = 0

Method Summary

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

IntegerIntegerEnumWithDefaultValueEnums

public enum IntegerIntegerEnumWithDefaultValueEnums
extends Enum<IntegerIntegerEnumWithDefaultValueEnums>

A class that stores Integer enum values

Enum Constant Summary

Enum Constant Description
POSITIVE_0 value = 0
POSITIVE_1 value = 1
POSITIVE_2 value = 2

LongIntegerEnumWithDefaultValueEnums

public enum LongIntegerEnumWithDefaultValueEnums
extends Enum<LongIntegerEnumWithDefaultValueEnums>

A class that stores Long enum values

Enum Constant Summary

Enum Constant Description
POSITIVE_0 value = 0L
POSITIVE_1 value = 1L
POSITIVE_2 value = 2L

FloatIntegerEnumWithDefaultValueEnums

public enum FloatIntegerEnumWithDefaultValueEnums
extends Enum<FloatIntegerEnumWithDefaultValueEnums>

A class that stores Float enum values

Enum Constant Summary

Enum Constant Description
POSITIVE_0 value = 0.0f
POSITIVE_1 value = 1.0f
POSITIVE_2 value = 2.0f

DoubleIntegerEnumWithDefaultValueEnums

public enum DoubleIntegerEnumWithDefaultValueEnums
extends Enum<DoubleIntegerEnumWithDefaultValueEnums>

A class that stores Double enum values

Enum Constant Summary

Enum Constant Description
POSITIVE_0 value = 0.0d
POSITIVE_1 value = 1.0d
POSITIVE_2 value = 2.0d

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