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 voidapplyToConfigBuilder(SchemaGeneratorConfigBuilder builder)Apply this module to the given configuration builder instance.static SimpleTypeModuleforPrimitiveAndAdditionalTypes()Factory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counterparts (e.g.static SimpleTypeModuleforPrimitiveTypes()Factory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counter parts (e.g.SimpleTypeModulewithBooleanType(Class<?> javaType)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_BOOLEAN".SimpleTypeModulewithEmptySchema(Class<?> javaType)Add the given mapping for a (simple) java class that should be represented by an empty schema.SimpleTypeModulewithIntegerType(Class<?> javaType)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".SimpleTypeModulewithIntegerType(Class<?> javaType, String openApiFormat)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".SimpleTypeModulewithNumberType(Class<?> javaType)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.SimpleTypeModulewithNumberType(Class<?> javaType, String openApiFormat)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.SimpleTypeModulewithObjectType(Class<?> javaType)Deprecated.rather usewithEmptySchema(Class)instead to really allow any valueSimpleTypeModulewithStandardStringType(Class<?> javaType, String standardFormat)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".SimpleTypeModulewithStringType(Class<?> javaType)Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".SimpleTypeModulewithStringType(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 theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counter parts (e.g.booleanandBoolean).- Returns:
- created module instance
- See Also:
forPrimitiveAndAdditionalTypes()
-
forPrimitiveAndAdditionalTypes
public static SimpleTypeModule forPrimitiveAndAdditionalTypes()
Factory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counterparts (e.g.booleanandBoolean) 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_FORMATvalue, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
withStandardStringType
public final SimpleTypeModule withStandardStringType(Class<?> javaType, String standardFormat)
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 definitionstandardFormat- optionalSchemaKeyword.TAG_FORMATvalue, to set if one of the respective Options 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_FORMATvalue, 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_FORMATvalue, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
applyToConfigBuilder
public void applyToConfigBuilder(SchemaGeneratorConfigBuilder builder)
Description copied from interface:ModuleApply this module to the given configuration builder instance.- Specified by:
applyToConfigBuilderin interfaceModule- Parameters:
builder- configuration builder instance to which to apply this module
-
-