Re: complex types again

Marc Logemann <[email protected]> Tue, 2 Dec 2003 19:05:42 +0100
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <MeNNbH4xqRwYHM3A7Q6raeMgCvPQGKxuUDfWrCWHNZ8@akmail>
Hi,

thanks again, this does the trick. I am still dreaming for reflection on these devices, then it would
be no problem to write a standard BeanDeserializer like provided with Axis.

Also interessting would be, how the JSR-127 is going to handle the ser/deser issue.

>> usable error message. Can it be that i have to completely define the
>> returning struct as a class?

> Just build a switch/case in the getPropertyInfo method similar to the
> following code fragment:

> public class GolfCourse implements KvmSerializable {

>      String name;   // 0
>      String tee;    // 1

>      static final int[] COUNT = 2;

>      static final String[] IGNORE = {"foo"};

>      public getPropertyCount(){
>         return COUNT + IGNORE.length;
>      }

>      public void setProperty(int index, Object value){
>         switch(index){
>         case 0: name = (String) value; break;
>         case 1: tee = (String) value; break;
>         }
>      }

>      public Object getProperty(int index){
>         switch(index){
>         case 0: return name;
>         case 1: return tee;
>         default: return null;
>      }


>      public void getPropertyInfo(int index, PropertyInfo info, Hashtable
> vi){
>         switch(index){
>         case 0:
>            info.name = "name";
>            info.type = ElementType.STRING_CLASS;
>            break;
>         case 1:
>            info.name = "tee";
>            info.type = ElementType.STRING_CLASS;
>            break;
>         default:
>            info.name = IGNORE[index-COUNT];
>            info.type = ElementType.STRING_CLASS;
>         }
>      }


---
regards
Marc Logemann
check http://www.logemann.org