Closed jansupol closed 7 years ago
@glassfishrobot Commented Reported by keilw
@glassfishrobot Commented @m0mus said: It's done this way to allow vendors adding implementation specific Strategies and work with them in consistent way.
@glassfishrobot Commented keilw said: Two of them are interfaces, but how would you extend final class BinaryDataStrategy or final class PropertyOrderStrategy? The final classes are just like enums, you cannot extend them. With those constant collections in an interface it makes sense, but how would they add anything to a final class?
@glassfishrobot Commented @m0mus said: These classes are NOT designed to be extended. They holds constants supported by the API.
JsonbConfig has withPropertyOrderStrategy and withBunaryDataStrategy methods. Both of them accept a String parameter. In case vendors (not users!) want to support more strategies than defined in the API they need to create their own constants and use it in config this way:
withPropertyOrderStrategy(VendorPropertyOrderStrategy.WHATEVER);
@glassfishrobot Commented
keilw said:
Thanks for explaining the difference. Vendors are of course users or consumers of the JSR/API/SPI
JSF among other cases showed, enums can be tricky in certain cases when you try to extend them.
@glassfishrobot Commented Was assigned to roman.grigoriadi
@glassfishrobot Commented This issue was imported from java.net JIRA JSONB_SPEC-44
@glassfishrobot Commented Marked as won't fix on Friday, March 3rd 2017, 5:51:22 am
I noticed at least 2 elements of javax.json.bind.config, BinaryDataStrategy and PropertyOrderStrategy are final classes defining nothing but static string constants like
All of these constants contain nothing but the name of the constants. This has all symptoms of an enum so why weren't these two defined as enums?
Affected Versions
[1.0 Public Review]