-
Notifications
You must be signed in to change notification settings - Fork 3
ModelGenerator: Put default values into the Class Constructor #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@mjacoby can you please review the constructors of https://github.com/eclipse-digitaltwin/aas4j/tree/update-to-rc02/model/src/main/java/org/eclipse/aas4j/v3/model, e.g., the DefaultSubmodel? |
Most default values seem to be properly intialized. However, I found some more mentions of default values in the specification (v3.0RC02):
Conclusion I'm not 100% sure how to handle these because these default values are defined differently from the other default values. 1 & 2 are defined as constraints, so they theoretically should not be relevant for designing the model classes. However, they define default values and the constructors seem to be the right place to handling default values. My personal opinion would be to handle default values in 1 & 2 like regular default values and propose to change the specification to move the default value definition from constraint to the class definition. 3 is part of the security part of the meta-model that we currently do not implement and which is currently not normative AFAIK. Therefore we can probably ignore it for now. However, we should also think how to address these default values once this part becomes normative as it cannot be solved with the generated code pattern we are using now. @sebbader-sap What is your take on this? |
The 'easy' topic first:
True, therefore I also vote for leaving it out for now. There shall be a rework of the security model, and I want to wait until then. |
I have a conceptual problem with these constraints in the generator, which currently prohibit me to find a proper pattern to generate the constructor... |
I agree with you however that this should be the way to go. |
What do you propose that we do now? From my perspective we are currently on hold until this issue is resolved in one way or another. |
First, less meetings and more time to get things done :-) But seriously, I can certainly come up with something in the generator today or tomorrow. If that's the only thing left which blocks us here, that'll be possible. |
Ok, so we are going to set the default values for those two constraints in the constructors. That is something I can live and work with. |
I need to further dig into this on Monday, no chance to get it fixed this week. |
I just found a solution and pushed the newly generated classes: eclipse-aas4j/aas4j@b83940f @mjacoby please check them. |
Looks good - all default values seem to be properly set. However, I noticed two other issues
|
I have noticed this, too. It's a bit of an arbitrary behaviour of the |
Interesting, as FA³ST is using spotless and I never ever encountered that it introduces wildcard imports. So I would assume it's probably just an configuration issue. There seems to also be a feature in spotless to replace wildcard imports with regular imports diffplug/spotless#649 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
The attributes
SubmodelElementList.orderRelevant
andHasKind.kind
have default values (true
andInstance
) which have not been regarded by the model. Currently, if not set explicitly in the Builders,orderRelevant
is initialised withfalse
.Proposal: Add a clause to the ontology or shapes, describing the default value, and add a function to the ModelGenerator to set these default values in the class constructors. For instance for
Submodel
:The text was updated successfully, but these errors were encountered: