jaxb-ri icon indicating copy to clipboard operation
jaxb-ri copied to clipboard

allow XmlJavaTypeAdapter on entire Collection

Open Tomas-Kraus opened this issue 18 years ago • 4 comments

Please consider allowing XmlJavaTypeAdapter / XmlAdapter to apply to an entire Collection, not just to individual items inside a Collection. For example:

class Foo {

@XmlJavaTypeAdapter(value=MyListAdapter.class, type=List.class) private List<Bar> bars; }


Or in package-info.java:

@XmlJavaTypeAdapters(

{ @XmlJavaTypeAdapter(value=MyCollectionAdapter.class, type=Collection.class), @XmlJavaTypeAdapter(value=MySetAdapter.class, type=Set.class), @XmlJavaTypeAdapter(value=MyListAdapter.class, type=List.class)}

) package com.mycompany.foo;

import java.util.Collection; import java.util.List; import java.util.Set;


class MyListAdapter extends XmlAdapter<List, List> {

@Override public List marshal(List v) throws Exception

{ List result = new ArrayList(v); // manipulate the list; maybe filter some elements return result; }

@Override public List unmarshal(List v) throws Exception

{ // do something with the list return v; }

}

Environment

Operating System: All Platform: All

Affected Versions

[2.1 EA1]

Tomas-Kraus avatar Nov 14 '06 14:11 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/279
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 14:09 Tomas-Kraus

@glassfishrobot Commented Reported by [email protected]

Tomas-Kraus avatar Nov 14 '06 14:11 Tomas-Kraus

@glassfishrobot Commented Was assigned to snajper

Tomas-Kraus avatar Nov 14 '06 14:11 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-279

Tomas-Kraus avatar Apr 24 '17 11:04 Tomas-Kraus