[
https://issues.apache.org/jira/browse/SHINDIG-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579963#action_12579963
]
Michael Papp commented on SHINDIG-124:
--------------------------------------
Hi Cassie - thanks again for your assistance with this code.
1. Will remove author tag
2. Here is my reasoning for the implementation:
a. Rules for Enum:
displayValue can never be null.
Key may be null.
if displayValue is one of the pre-defined constants, then
displayValue == Key.toString().
if displayValue is not one of the pre-defined constants, then
Key = null; displayValue = arbitrary string.
b. Enum(Key key, String displayValue) is an unnecessary constructor, as
either the Key is equivalent to the Value (String), or the Key != Value and the
Key is null. Therefore, only the displayValue matters - not the Key. Still,
for conformity, I could implement this constructor and throw away the Key.
c. The reverse look up on the enum Key properties enforces this contract.
As per your previous response and my understanding of the API, this
implementation fits the requirements (and darn it, I am a stickler for
requirements). And while I can see the motivation for providing placeholder
model classes and let developers fill in the blanks, I generally believe that
such 'model' implementations should serve as reference implementations (go the
extra mile, so to speak). All that said, I really do like your generics
approach, much cleaner looking, etc. Let me play around with this today and
respond with something this afternoon. Unless you or the team think the
"contract enforcement" aspect is overboard, I really do urge the interested
parties to keep this in the implementation.
> Implementation POJO for opensocial.Enum.xx and opensocial.Message
> -----------------------------------------------------------------
>
> Key: SHINDIG-124
> URL: https://issues.apache.org/jira/browse/SHINDIG-124
> Project: Shindig
> Issue Type: New Feature
> Components: Gadgets Server - Java
> Reporter: Michael Papp
> Attachments: fix-124-1-bug.patch.txt, fix-124-2-bug.patch.txt,
> fix-124-bug.patch.txt
>
>
> Submitting proposed implementation for opensocial.Enum and
> opensocial.Enum.Drinker, opensocial.Enum.Gender, and opensocial.Enum.Smoker.
> This is a best guess pass as there are a number of ways of implementing this,
> and opensocial 0.7 spec for the getKey() is rather nebulous. Anyway, hope
> this helps. If approach is right, then I can amend patch to include tests.
> M. Papp
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.