Any thoughts?
Saludos.- ______________________ Nicolás Mariano Obregón [email protected] <http://ar.linkedin.com/in/nmobregon> <http://www.facebook.com/nmobregon> <http://www.facebook.com/nmobregon> El 19 de octubre de 2011 18:24, Nicolás Mariano Obregón <[email protected] > escribió: > Hi all! I'm having a bit of a headache trying to pass an enum object to my > webservice using KSOAP. > Here's the code > > *This class is the WS main parameter thats owns the enum* > > public class MyObject implements KvmSerializable{ > > ... > private MyEnum myEnum; > ... > > @Override > public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) { > switch (arg0){ > case 0: > arg2.type = MyEnum.class; > arg2.name = "myEnum"; > break; > > case1: > > ... > > } > } > > > *This is the enum Class* > > public enum MyEnum implements KvmSerializable { > > VALUE1, > VALUE2, > VALUE3, > VALUE4; > > public String value() { > return name(); > } > > public static MyEnum fromValue(String v) { > return valueOf(v); > } > > @Override > public Object getProperty(int arg0) { > // TODO Auto-generated method stub > return value(); > } > > @Override > public int getPropertyCount() { > // TODO Auto-generated method stub > return 1; > } > > @Override > public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) > { > arg2.type = PropertyInfo.STRING_CLASS; > arg2.name = "value"; > } > > @Override > public void setProperty(int arg0, Object arg1) { > } > } > > I'm not very comfortable with this code because I don't really like the > getPropertyInfo on the enum. > Any help? Is there anyway to pass an enum as a parameter or I shouldn't be > using enums here? > > Thanks in advance! > > ______________________ > Saludos.- > Nicolás Mariano Obregón > [email protected] > <http://ar.linkedin.com/in/nmobregon> <http://www.facebook.com/nmobregon> > <http://www.facebook.com/nmobregon> > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

