-
Notifications
You must be signed in to change notification settings - Fork 9
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
Specification Writer Error with Parameters #17
Comments
I had a quick look at Part5 of the tutorial, where a small spec with parameters is exported. The export has the same problem you mentioned. |
Concerning point (1): You have inspected the attributes by choosing the according attribute in the drop-down list, right? This is an other weird thing. In this case it shows the default value. But if you hover over the element, it actually shows you the correct parameter values. Concerning point (2): I do not 100 % understand your question, but a parameter-based exploration definitely works as long as you set the parameters directly for the Element (the Java object) and do not store and reload it via xml in between. |
Okay, I have added a test that checks (branch testForIssue17) that the process of reading and writing results in the same attribute for the annotated element. The problem also may lie with the getAttribute() method which returns the default value in case that the attribute is parametrized. |
This is exactly what I mean with (2): if you set a parameter attribute, and subsequently call getAttribute(), the type of the returned attribute is the class of the default value, and not class ParameterSelect, as is required by the Writer... |
The problem seems to come from the following method in Attributes.java, that - if an attribute is a parameter - returns the (default) value of a Parameter object, instead of the object itself. Fixing this and simply returning the Parameter object should resolve the error with the SpecificationWriter (since, again, the Writer checks if an attribute is instanceof Parameter). I am, however, not sure if any other parts of OpenDSE rely on the fact that getAttribute() works in this way?!
|
How about the Element.getAttributeParameter(String identifier) method in the Element class (package: net.sf.opendse.model). Iterating all the attributes of the element and checking whether the method returns a non-null value should give us all parameters in the spec. Then we just need to agree on the syntax to write into the .xml and teach the writer and the reader to follow this syntax. |
When the specification writer is used to generate the xml file of a specification where parameters are defined for a certain attribute, it generates an xml file where the corresponding attribute is set to the default value instead of writing the appropriate parameter.
The text was updated successfully, but these errors were encountered: