There are special use-cases that each language supports; this document pertains to Java models.
- Include equals function for the class
- Include hashCode function for the class
- Change the collection type for arrays
- Include toString function for the class
- Include JavaDoc for properties
- Include Javax validation constraint annotations for properties
- Include Jackson annotations for the class
- Include JSON marshaling and unmarshaling methods
To overwrite the equal
method, use the preset JAVA_COMMON_PRESET
and provide the option equal: true
.
Check out this example for a live demonstration.
To overwrite the hashCode
method, use the preset JAVA_COMMON_PRESET
and provide the option hashCode: true
.
Check out this example for a live demonstration.
Sometimes, we might want to render a different collection type, and instead of the default Array
use as List
type. To do so, provide the option collectionType: 'List'
.
Check out this example for a live demonstration.
To overwrite the toString
method, use the preset JAVA_COMMON_PRESET
and provide the option classToString: true
.
Check out this example for a live demonstration.
To generate models containing JavaDocs
from description and examples, use the JAVA_DESCRIPTION_PRESET
option.
Check out this example for a live demonstration.
In some cases, when you generate the models from JSON Schema, you may want to include javax.validation.constraint
annotations.
Check out this example for a live demonstration.
To generate Java data models with Jackson annotation using JAVA_JACKSON_PRESET
option.
Check out this example for a live demonstration.
Sometimes you just want to convert your class to JSON without the use of annotations such as Jackson.
Check out this example for a live demonstration.
External dependencies
- Requires org.json package to work