JEAF Generator uses UML models to generate code for Spring, REST, OpenAPI, Java and others. Boost your software development efficiency and time-to-market. Bye bye handwritten boiler blade code.
Keep Java Code backward compatible (no breaking changes)
Simplify backward compatibility for developers (try to generated standard cases)
Legacy should be marked as deprecated (it should not just disappear)
Documentation of legacy property should be preserved
Should be applicable for properties and associations and also for soft links
Supported Scenarios
Pure renaming of property
Scenarios not in scope but may be supported later (#218)
Switch from single valued to multi valued property (including renaming)
Switch from multi valued to single valued property (including renaming)
Structural changes (removing / adding of indirection in object model)
Changes of primitive types
Switch of primitive types e.g. String -> long, long -> int
Solution Proposal
UML Model
Extend stereotype JEAFDeprecated with tagged values generateBackwardCompatibility and successorName. Using these two tags backward compatibility as described below can be activated.
JEAF Generator
New tagged values are only applicable for deprecations of properties, so checks need to be extended.
successorProperty must exist in UML model
OpenAPI
Legacy property and new properties will be generated in OpenAPI spec. No changes compared to current behavior.
Java
Jackson annotation @JsonGetter and @JsonAlias should help.
New property plus legacy accessors in POJO and builder
of(..) operation should not change its signature if only a property will be renamed. In cases of change multiplicity a deprecated of operation should be generated as well.
@JsonGetter on deprecated Java getter will cause that the "legacy property" is also added to generated JSON.
@JsonAlias will cause that old and new property are still understood during deserialization. New property will be preferred if both are available.
Requirements
Supported Scenarios
Scenarios not in scope but may be supported later (#218)
String
->long
,long
->int
Solution Proposal
UML Model
JEAFDeprecated
with tagged valuesgenerateBackwardCompatibility
andsuccessorName
. Using these two tags backward compatibility as described below can be activated.JEAF Generator
successorProperty
must exist in UML modelOpenAPI
Java
@JsonGetter
and@JsonAlias
should help.of(..)
operation should not change its signature if only a property will be renamed. In cases of change multiplicity a deprecated of operation should be generated as well.@JsonGetter
on deprecated Java getter will cause that the "legacy property" is also added to generated JSON.@JsonAlias
will cause that old and new property are still understood during deserialization. New property will be preferred if both are available.