在WebParam中区分Null和空集合

时间:2014-09-17 06:57:17

标签: java web-services annotations cxf

@WebService
public interface MyService {
  public void doStuff( @WebParam(name = "someObjectList") List<SomeObject> someObjectList);
}

我想区分null和空列表。我该如何注释@WebParam someObjectList

应该可以,我找到了JAXB example

我用apache生成ws cxf 3.0.1

1 个答案:

答案 0 :(得分:2)

最合乎逻辑的做法是:

public class MyListParameter {

 @XmlElementWrapper(nillable=true)
 public List<MyObject> myObjects;

}

然后:

@WebService
public interface MyService {
  public void doStuff( @WebParam(name = "someObjectList") MyListParameter someObjectList);
}