Skip to content

Inherited Form Fields #78

Closed
Closed
@lbispham

Description

@lbispham

Description

I have form fields that are reused across multiple forms. I want to put them into a base class and have the individual forms inherit some of their fields from their parent class.

Steps to Reproduce

Simplified example:

public class GeneralSettings implements Serializable {

@Tab(title = "General Settings", index = 0) @CheckBox(title = "Enabled") private boolean enabled; public boolean getEnabled() { return enabled; } 

}

public class MoreSettings extends GeneralSettings {

@Tab(title = "More Settings", index = 1) private int maximum; public int getMaximum() { return maximum; } 

}

To run:
UiForm uiForm = UiFormSchemaGenerator.get().generate(MoreSettings.class);

Expected behavior: [What you expect to happen]

I expect the schema to contain two properties and the form to contain two nodes: enabled and maximum

Actual behavior: [What actually happens]

The generated schema contains both fields, but the form contains only the field declared in MoreSettings, not the field declared in its parent.

Versions

1.0.0

Additional Information

I see a call to getDeclaredFields() inside UiFormSchemaGenerator.generate() so maybe this behavior is intentional. Please let me know.

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close