Class PojoGenerator
- java.lang.Object
-
- org.apache.johnzon.jsonschema.generator.PojoGenerator
-
public class PojoGenerator extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPojoGenerator.Attributestatic classPojoGenerator.PojoConfigurationstatic classPojoGenerator.Ref
-
Field Summary
Fields Modifier and Type Field Description protected List<PojoGenerator.Attribute>attributesprivate PojoGenerator.PojoConfigurationconfigurationprotected Set<String>importsprivate booleanisEnumprotected Map<String,String>nested
-
Constructor Summary
Constructors Constructor Description PojoGenerator(PojoGenerator.PojoConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringafterClassName()protected StringafterEnumName(Map<String,String> values, boolean valuesAreInjected)protected StringasType(String javaName, jakarta.json.JsonObject schema, boolean required)protected StringbeforeClassDeclaration()protected StringbeforeClassEnd()protected StringbeforeEnumDeclaration()protected StringbeforeEnumEnd()private voiddoEnum(jakarta.json.JsonValue enumList, String className)protected StringenumImports()protected StringenumName(String javaName, jakarta.json.JsonObject schema)Map<String,String>generate()private static <T> TgetValueAs(jakarta.json.JsonObject schema, String attribute, Class<T> type)protected booleanisReserved(String name)protected PojoGeneratornewSubPojoGenerator(PojoGenerator.PojoConfiguration pojoConfiguration, jakarta.json.JsonObject schema)protected StringonEnum(String javaName, jakarta.json.JsonValue enumList, jakarta.json.JsonObject schema)protected StringonItemSchema(String javaName, jakarta.json.JsonObject schema)protected StringonObjectAttribute(String javaName, jakarta.json.JsonObject schema)protected StringonRef(PojoGenerator.Ref ref)PojoGeneratorsetNested(Map<String,String> nested)protected StringtoCamelCase(String name)protected StringtoJavaName(String key)private static <T> TvalueAs(jakarta.json.JsonObject schema, Class<T> type, jakarta.json.JsonValue value)PojoGeneratorvisitSchema(jakarta.json.JsonObject schema)
-
-
-
Field Detail
-
configuration
private final PojoGenerator.PojoConfiguration configuration
-
attributes
protected final List<PojoGenerator.Attribute> attributes
-
isEnum
private boolean isEnum
-
-
Constructor Detail
-
PojoGenerator
public PojoGenerator(PojoGenerator.PojoConfiguration configuration)
-
-
Method Detail
-
setNested
public PojoGenerator setNested(Map<String,String> nested)
-
visitSchema
public PojoGenerator visitSchema(jakarta.json.JsonObject schema)
-
onRef
protected String onRef(PojoGenerator.Ref ref)
- Parameters:
ref- the reference to resolve.- Returns:
- the reference class name if resolved else null.
-
beforeEnumEnd
protected String beforeEnumEnd()
-
beforeClassEnd
protected String beforeClassEnd()
-
afterClassName
protected String afterClassName()
-
afterEnumName
protected String afterEnumName(Map<String,String> values, boolean valuesAreInjected)
- Parameters:
values- the enum values (key is json name, value is java name).valuesAreInjected- is there a toString() with json name or is the enum anemic (only values, no method)- Returns:
- the data to add after enum name and before the opening brace in enum declaration.
-
enumImports
protected String enumImports()
-
beforeEnumDeclaration
protected String beforeEnumDeclaration()
-
beforeClassDeclaration
protected String beforeClassDeclaration()
-
onEnum
protected String onEnum(String javaName, jakarta.json.JsonValue enumList, jakarta.json.JsonObject schema)
-
doEnum
private void doEnum(jakarta.json.JsonValue enumList, String className)
-
onObjectAttribute
protected String onObjectAttribute(String javaName, jakarta.json.JsonObject schema)
-
newSubPojoGenerator
protected PojoGenerator newSubPojoGenerator(PojoGenerator.PojoConfiguration pojoConfiguration, jakarta.json.JsonObject schema)
-
isReserved
protected boolean isReserved(String name)
-
getValueAs
private static <T> T getValueAs(jakarta.json.JsonObject schema, String attribute, Class<T> type)
-
valueAs
private static <T> T valueAs(jakarta.json.JsonObject schema, Class<T> type, jakarta.json.JsonValue value)
-
-