I have a class like this:
@XmlRootElement(name = "PricingGroup")
public class PricingGroup {
    ...
    @XmlAttribute(name = "partyName")
    @XmlJavaTypeAdapter(CustomerGroupRelationships.Adapter.class)
    private List<BilltoCustomer> billtoCustomers = new ArrayList<BilltoCustomer>();
    @XmlAttribute(name = "partyName")
    @XmlJavaTypeAdapter(PartyNames.Adapter.class)
    private PartyName partyName;  
    ...  
}
It seems JAXB can't map two @XmlJavaTypeAdapters for one attribute (here partyName). If I comment out either the a开发者_C百科nnotations on billtoCustomers or the annotations on partyName, the other member variable is read from XML without problems. 
How can I get both values at the same time?
You could map one of the properties (partyName) and then use an afterUnmarshal event to derive the other property (billToCustomers):
@XmlRootElement(name = "PricingGroup")
public class PricingGroup {
    ...
    @XmlTransient    
    private List<BilltoCustomer> billtoCustomers = new ArrayList<BilltoCustomer>();
    @XmlAttribute(name = "partyName")
    @XmlJavaTypeAdapter(PartyNames.Adapter.class)
    private PartyName partyName;  
   void afterUnmarshal(Unmarshaller u, Object parent) {
      // Derive billToCustomers from partyName
   }
    ...  
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论