slub.team team mailing list archive
-
slub.team team
-
Mailing list archive
-
Message #00432
Re: [Merge] lp:~zeutschel/goobi-production/extended-jersey-api into lp:goobi-production
Btw, the compiler warning is issued because JAXB dissects classes by introspection that the compiler isn’t aware of. The annotations do turn into getter methods hidden from it. One can argue over wether that is a good design; but I don’t really think adding unused methods to a class that make use of its variables just to make the compiler not complain the variables are unused isn’t a good design, either.
Second, arbitrary setter methods open the floodgates to misuse the respective classes. E.g. org.goobi.webapi.beans.Label was designed with an Enum type which has to be passed to its constructor and which results in that it is used with exactly one attribute. This is sensible: *Either* it can be used to label a fixed String value by a human readable label *or* to label a human readable String with its respective language. Other combinations are not intended. E.g.:
• A labelled tag should not go without any label. In these cases, the class would be a maniac overhead and should not be used at all.
• A String labelled with its language shouldn’t carry a ‘label’ attribute; this would result in ambiguity. If you have <foo label="hello world" lang="en">bar</foo> this is likely to be read as ‘bar’ being in language ‘en’, but not that ‘lang’ describes the language of the ‘label’ attribute. This should be coded otherwise, e.g. <foo><bar><label lang="en">hello world</label></bar><foo>
• More rather senseless usages, such as <foo label="bar" /> are possible now.
All of those cases were not possible in the origin design, and are now possible since the class stands there open-heart. To regain its intended functionality, there would be need for some onBeforeMarshaling() event handler which rises a misuse error when marshalling is initiated before the object has come into a desirable state. I don’t think the framework even provides for that.
--
https://code.launchpad.net/~zeutschel/goobi-production/extended-jersey-api/+merge/133922
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
Follow ups
References