[
https://issues.apache.org/jira/browse/SHINDIG-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579817#action_12579817
]
Cassie Doll commented on SHINDIG-124:
-------------------------------------
Hey Michael -
Thanks for redoing all of this. I only have two comments this time:
1. We don't use author tags in Shindig.
2. I was picturing something a little simpler for the design of these classes.
Namely something like this:
public interface Enum {
public String getDisplayValue();
public Object getKey(); // as long as getKey().toString() is json then
everything is cool because they are just enums than that is fine
}
public final class Drinker extends AbstractGadgetData implements Enum {
private String displayValue;
private Key key;
public enum Key {
HEAVILY, NO
}
public Drinker(String displayValue) {
this(null, displayValue);
}
public Drinker(Key key, String displayValue) {
this.key = key;
this.displayValue = displayValue;
}
// setters and getters
}
So then the java code can make any sort of Drinker it wants, it is only a
simple pojo and it matches the js interface. You could even go simpler and use
generics to achieve this:
public class Enum<T> extends AbstractGadgetData {
public String getDisplayValue();
public T getKey();
// basic constructor + setters and getters
public enum Drinker { yes, no, etc etc}
}
// In Person.java
private Enum<Drinker> drinker;
private Enum<Smoker> smoker;
What do you think?
(I prefer the generics one - less code and such)
Thanks for your help!
- Cassie
> 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.