Description
The metaschema-maven-plugin code generator should produce binding classes that are fully compliant with project Javadoc and null-safety standards without requiring manual editing.
Current Behavior
The generator produces:
Proposed Enhancements
1. Constructor Javadoc
Generate Javadoc for both constructors:
/**
* Constructs a new {ClassName} instance with no metadata.
*/
public {ClassName}() {
this(null);
}
/**
* Constructs a new {ClassName} instance with the specified metadata.
*
* @param data
* the metaschema data, or {@code null} if none
*/
public {ClassName}(@Nullable IMetaschemaData data) {
this.__metaschemaData = data;
}
2. Accessor Method Javadoc
Generate Javadoc for getters/setters based on field description:
/**
* Get the {field description from Metaschema}.
*
* @return the {field name}, or {@code null} if not set
*/
@Nullable
public {Type} get{Name}() {
return _{fieldName};
}
/**
* Set the {field description from Metaschema}.
*
* @param value
* the {field name} to set
*/
public void set{Name}(@Nullable {Type} value) {
_{fieldName} = value;
}
3. Null-Safety Annotations
Add appropriate annotations based on Metaschema required attribute:
required: yes → Consider @NonNull (with validation)
required: no or unspecified → @Nullable
For fields that can be null in the Java object model (even if required in the schema), use @Nullable on getters and setters.
Related
Description
The metaschema-maven-plugin code generator should produce binding classes that are fully compliant with project Javadoc and null-safety standards without requiring manual editing.
Current Behavior
The generator produces:
Proposed Enhancements
1. Constructor Javadoc
Generate Javadoc for both constructors:
2. Accessor Method Javadoc
Generate Javadoc for getters/setters based on field description:
3. Null-Safety Annotations
Add appropriate annotations based on Metaschema
requiredattribute:required: yes→ Consider@NonNull(with validation)required: noor unspecified →@NullableFor fields that can be null in the Java object model (even if required in the schema), use
@Nullableon getters and setters.Related