org.openapijsonschematools.client.components.schemas.Currency.java
public class Currency
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
Modifier and Type | Class and Description |
---|---|
sealed interface | Currency.Currency1Boxed sealed interface for validated payloads |
record | Currency.Currency1BoxedString boxed class to store validated String payloads |
static class | Currency.Currency1 schema class |
enum | Currency.StringCurrencyEnums String enum |
public sealed interface Currency1Boxed
permits
Currency1BoxedString
sealed interface that stores validated payloads using boxed classes
public record Currency1BoxedString
implements Currency1Boxed
record that stores validated String payloads, sealed permits implementation
Constructor and Description |
---|
Currency1BoxedString(String data) Creates an instance, private visibility |
Modifier and Type | Method and Description |
---|---|
String | data() validated payload |
@Nullable Object | getData() validated payload |
public static class Currency1
extends JsonSchema
A schema class that validates payloads
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.Currency;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());
// String validation
String validatedPayload = Currency.Currency1.validate(
"eur",
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of( String.class ) |
Set | enumValues = SetMaker.makeSet( "eur", "usd" ) |
Modifier and Type | Method and Description |
---|---|
String | validate(String arg, SchemaConfiguration configuration) |
String | validate(StringCurrencyEnums arg, SchemaConfiguration configuration) |
Currency1BoxedString | validateAndBox(String arg, SchemaConfiguration configuration) |
Currency1Boxed | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public enum StringCurrencyEnums
extends Enum<StringCurrencyEnums>
A class that stores String enum values
Enum Constant | Description |
---|---|
EUR | value = "eur" |
USD | value = "usd" |