1
JAXBContext jaxbContext = JAXBContext.newInstance(BatchwisePricingJob.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
StringReader reader = new StringReader(batchprice.toString());
BatchwisePricingJob batch = (BatchwisePricingJob) jaxbUnmarshaller.unmarshal(reader);
ArrayList<Price> pricingOfProduct = batch.getPricingOfProduct();
int i = 0;
for (Price price : pricingOfProduct) {
i++;
System.out.println("customer id:" + i + " " + price.getCustomerId());
System.out.println("material id:" + i + " " + price.getMaterialId());
}
는 게터/세터에 @XmlElement
annotaion을 부여하지만, 그것은 Illegealannotationexception
JAXB Unmarshaller에 판독 값은 0
Class has two properties of the same name "customerId"
this problem is related to the following location:
at public int com.efl.efms.batch.ws.data.batchwisePricing.Price.getCustomerId()
at com.efl.efms.batch.ws.data.batchwisePricing.Price
at private java.util.ArrayList com.efl.efms.batch.ws.data.batchwisePricing.BatchwisePricingJob.pricingOfProduct
at com.efl.efms.batch.ws.data.batchwisePricing.BatchwisePricingJob
this problem is related to the following location:
at private int com.efl.efms.batch.ws.data.batchwisePricing.Price.customerId
at com.efl.efms.batch.ws.data.batchwisePricing.Price
at private java.util.ArrayList com.efl.efms.batch.ws.data.batchwisePricing.BatchwisePricingJob.pricingOfProduct
at com.efl.efms.batch.ws.data.batchwisePricing.BatchwisePricingJob
을 앞으로 코드를 포맷하고 편집기에 코드를 붙여 넣을 때 코드 ('{}') 버튼을 사용하십시오. XML과 바인딩 된 클래스를 보지 않고도 추측을 제외하고는 할 수있는 일이 많지 않습니다. 그것은 우리 시간과 당신의 낭비입니다. –