Class SimpleTypeModule
- java.lang.Object
-
- com.github.victools.jsonschema.generator.impl.module.SimpleTypeModule
-
-
Constructor Summary
Constructors Constructor Description SimpleTypeModule()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyToConfigBuilder(SchemaGeneratorConfigBuilder builder)
Apply this module to the given configuration builder instance.static SimpleTypeModule
forPrimitiveAndAdditionalTypes()
Factory method: creating an instance of theSimpleTypeModule
containing mappings for various primitive types and their non-primitive counterparts (e.g.static SimpleTypeModule
forPrimitiveTypes()
Factory method: creating an instance of theSimpleTypeModule
containing mappings for various primitive types and their non-primitive counter parts (e.g.SimpleTypeModule
withBooleanType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_BOOLEAN
".SimpleTypeModule
withEmptySchema(Class<?> javaType)
Add the given mapping for a (simple) java class that should be represented by an empty schema.SimpleTypeModule
withIntegerType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER
".SimpleTypeModule
withIntegerType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER
".SimpleTypeModule
withNumberType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER
.SimpleTypeModule
withNumberType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER
.SimpleTypeModule
withObjectType(Class<?> javaType)
Deprecated.rather usewithEmptySchema(Class)
instead to really allow any valueSimpleTypeModule
withStringType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING
".SimpleTypeModule
withStringType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING
".
-
-
-
Method Detail
-
forPrimitiveTypes
public static SimpleTypeModule forPrimitiveTypes()
Factory method: creating an instance of theSimpleTypeModule
containing mappings for various primitive types and their non-primitive counter parts (e.g.boolean
andBoolean
).- Returns:
- created module instance
- See Also:
forPrimitiveAndAdditionalTypes()
-
forPrimitiveAndAdditionalTypes
public static SimpleTypeModule forPrimitiveAndAdditionalTypes()
Factory method: creating an instance of theSimpleTypeModule
containing mappings for various primitive types and their non-primitive counterparts (e.g.boolean
andBoolean
) as well as other classes that are normally serialised in a JSON as non-objects, e.g.BigDecimal
,BigInteger
,UUID
,LocalDate
,LocalDateTime
, and a number of other date-time types.- Returns:
- created module instance
- See Also:
forPrimitiveTypes()
-
withEmptySchema
public final SimpleTypeModule withEmptySchema(Class<?> javaType)
Add the given mapping for a (simple) java class that should be represented by an empty schema.- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withObjectType
@Deprecated public final SimpleTypeModule withObjectType(Class<?> javaType)
Deprecated.rather usewithEmptySchema(Class)
instead to really allow any valueAdd the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_OBJECT
".- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withStringType
public final SimpleTypeModule withStringType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING
".- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withStringType
public final SimpleTypeModule withStringType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING
".- Parameters:
javaType
- java class to map to a fixed JSON schema definitionopenApiFormat
- optionalSchemaKeyword.TAG_FORMAT
value, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
withBooleanType
public final SimpleTypeModule withBooleanType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_BOOLEAN
".- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withIntegerType
public final SimpleTypeModule withIntegerType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER
".- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withIntegerType
public final SimpleTypeModule withIntegerType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER
".- Parameters:
javaType
- java class to map to a fixed JSON schema definitionopenApiFormat
- optionalSchemaKeyword.TAG_FORMAT
value, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
withNumberType
public final SimpleTypeModule withNumberType(Class<?> javaType)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER
.- Parameters:
javaType
- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withNumberType
public final SimpleTypeModule withNumberType(Class<?> javaType, String openApiFormat)
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER
.- Parameters:
javaType
- java class to map to a fixed JSON schema definitionopenApiFormat
- optionalSchemaKeyword.TAG_FORMAT
value, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
applyToConfigBuilder
public void applyToConfigBuilder(SchemaGeneratorConfigBuilder builder)
Description copied from interface:Module
Apply this module to the given configuration builder instance.- Specified by:
applyToConfigBuilder
in interfaceModule
- Parameters:
builder
- configuration builder instance to which to apply this module
-
-