Skip to content

Enhance code generator to produce complete Javadoc for binding classes #571

@david-waltermire

Description

@david-waltermire

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions