Re: complex types again
Stefan Haustein <[email protected]> Tue, 02 Dec 2003 18:44:27 +0100
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Organization | University of Dortmund |
| Message-ID | <[email protected]> |
Marc Logemann wrote:
> Hi,
>
> thanks Stefan, this was a good hint. Now i am getting the Error "Unknown Property: foo", which is a quite
> 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;
}
}