ArrayList and type the return
Hello
i have a probleme with my class essentielly with my method look my class
import java.util.ArrayList;
import java.util.Iterator;
Code:
public class Personne {
ArrayList persones=new ArrayList<Personne>();
private long id;
private String nom="";
public long getId(){
return id;
}
public String getNom(){
return nom;
}
public long setId(long id){
return id=id;
}
public String setNom(String nom){
return nom=nom;
}
//here the problem the return
public String getPersone(){
Iterator iterateur=persones.iterator();
while(iterateur.hasNext()){
long id=((Personne)iterateur.next()).getId();
String nom=((Personne)iterateur.next()).getNom();
return id+""+nom;
}
return null;
}
public static void main(String arg[]){
Personne p1=new Personne();
p1.setNom("Amine");
p1.setId(0xAA3567B2C4FL);
Personne p2=new Personne();
p2.setId(0xAA93B10CD00L);
p2.setNom("Ali");
}
}
thanks
Re: ArrayList and type the return
Service operations can only operate on concrete implementations. This is not a limitation of WCF, this is a limitation (or, feature) of WSDL. So, if you want to accept any type to a generic Load() operation, and specify the type in the call, you'll have to design a contract that receives the type T as a parameter, and returns a List<object> or object[] that is an array of that type. I think you are fixated on the syntax looking like remoting, and generics...when what you really want is a solution that fits with semantics of service design.
Why not this?
List<object> Load(string objectType);
Re: ArrayList and type the return
thanks ,
my probleme concerne my methode getPersonne returns the id and name