我想将类中的数组名称添加到jList中,如下所示。
怎么可能?
这是显示类
中的方法 public void dataToLocal(List<XDataObject> data, XServiceType xst, XServiceOperation operation) {
if(operation.getName().equals(SNOWTAMSubscriberServiceInterface.OP_PUBLISSNOWTAM)) {
SNOWTAMPublication snowtamPublication =
(SNOWTAMPublication)data.get(0).getValue(); //This read an array with 5 values.
SNOWTAM snowtam = snowtamPublication.getSNOWTAM()[0]; //This read read the array and its contents.
jList1.add((Component) Arrays.asList((snowtamPublication.getSNOWTAM()[0]).toString())); //Here I want to add the name of Array to be as below
}
}
这是SNOWTAMPublication,它只是数组的get和set方法。
protected SNOWTAM[] snowtam;
public SNOWTAM[] getSNOWTAM() {
if(snowtam == null)
{
snowtam = new SNOWTAM[0];
}
return snowtam;
}
public void setSNOWTAM(SNOWTAM[] _value) {
this.snowtam = _value;
}
图片
答案 0 :(得分:-1)
你可以尝试:
<instance>.getClass().getSimpleName()