public class JaxbListWrapper<T> extends Object implements Serializable, Iterable<T>
A simple list wrapper for ensuring lists of JAXB objects serialize correctly.
You must annotate subclasses with XmlRootElement
and
then implement getObjects()
with an XmlElement
annotation
and a call to super.getObjects() so that it gets serialized properly.
Example implementation:
\@XmlRootElement(name="thingies") public static class ThingyCollection extends JaxbListWrapper<Thingy> { private static final long serialVersionUID = 1L; public ThingyCollection() { super(); } public ThingyCollection(final Collection<? extends Thingy> thingies) { super(thingies); } \@XmlElement(name="thingy") public List<Thingy> getObjects() { return super.getObjects(); } }
Constructor and Description |
---|
JaxbListWrapper() |
JaxbListWrapper(Collection<? extends T> objects) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T obj) |
boolean |
add(T obj) |
boolean |
addAll(Collection<? extends T> objs) |
boolean |
addAll(int index,
Collection<? extends T> objs) |
void |
clear() |
boolean |
contains(Object obj) |
boolean |
containsAll(Collection<?> objs) |
boolean |
equals(Object obj) |
T |
get(int index) |
Integer |
getCount() |
List<T> |
getObjects() |
Integer |
getOffset() |
Integer |
getTotalCount() |
int |
hashCode() |
int |
indexOf(Object obj) |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
lastIndexOf(Object obj) |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
remove(int index) |
boolean |
remove(Object obj) |
boolean |
removeAll(Collection<?> objs) |
boolean |
retainAll(Collection<?> objs) |
T |
set(int index,
T obj) |
void |
setCount(Integer count) |
void |
setObjects(List<? extends T> objects) |
void |
setOffset(Integer offset) |
void |
setTotalCount(Integer totalCount) |
int |
size() |
List<T> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] type) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public JaxbListWrapper()
public JaxbListWrapper(Collection<? extends T> objects)
public T get(int index)
public boolean add(T obj)
public Integer getCount()
public void setCount(Integer count)
public int size()
public Integer getTotalCount()
public void setTotalCount(Integer totalCount)
public Integer getOffset()
public void setOffset(Integer offset)
public void add(int index, T obj)
public boolean addAll(Collection<? extends T> objs)
public boolean addAll(int index, Collection<? extends T> objs)
public void clear()
public boolean contains(Object obj)
public boolean containsAll(Collection<?> objs)
public int indexOf(Object obj)
public boolean isEmpty()
public int lastIndexOf(Object obj)
public ListIterator<T> listIterator()
public ListIterator<T> listIterator(int index)
public boolean remove(Object obj)
public T remove(int index)
public boolean removeAll(Collection<?> objs)
public boolean retainAll(Collection<?> objs)
public Object[] toArray()
public <T> T[] toArray(T[] type)
Copyright © 2017. All rights reserved.