org.omnaest.utils.xml
Class JAXBSet<E>

java.lang.Object
  extended by org.omnaest.utils.xml.JAXBSet<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class JAXBSet<E>
extends Object
implements Set<E>

Set wrapper which acts as an XmlRootElement for any Set. Since the exact type of the internal Set instance is determined at runtime, each of the objects have its own schema definition. This will cause some overhead in comparison to a Set which is wrapped not by its interface.

Example:

 <set>
     <string>value3</string>
     <string>value1</string>
     <string>value2</string>
 </set>
 
 
For more details on the xml format see JAXBList.

Author:
Omnaest
See Also:
newInstance(Set)

Field Summary
protected  Set<E> set
           
 
Constructor Summary
protected JAXBSet()
          Used internally when JAXB does create a new default instance.
protected JAXBSet(Set<E> set)
           
 
Method Summary
 boolean add(E arg0)
           
 boolean addAll(Collection<? extends E> arg0)
           
 void clear()
           
 boolean contains(Object arg0)
           
 boolean containsAll(Collection<?> arg0)
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
static
<E> JAXBSet<E>
newInstance(Set<E> set)
          Creates a new instance of a JAXBSet for a given Set.
 boolean remove(Object arg0)
           
 boolean removeAll(Collection<?> arg0)
           
 boolean retainAll(Collection<?> arg0)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Field Detail

set

protected Set<E> set
Constructor Detail

JAXBSet

protected JAXBSet(Set<E> set)
Parameters:
set -
See Also:
#newInstance(Collection)

JAXBSet

protected JAXBSet()
Used internally when JAXB does create a new default instance.

Parameters:
list -
Method Detail

newInstance

public static <E> JAXBSet<E> newInstance(Set<E> set)
Creates a new instance of a JAXBSet for a given Set.

Type Parameters:
E -
Parameters:
set -
Returns:
new instance or null if set param is null

add

public boolean add(E arg0)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>

addAll

public boolean addAll(Collection<? extends E> arg0)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>

contains

public boolean contains(Object arg0)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>

containsAll

public boolean containsAll(Collection<?> arg0)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>

remove

public boolean remove(Object arg0)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>

removeAll

public boolean removeAll(Collection<?> arg0)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

retainAll

public boolean retainAll(Collection<?> arg0)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

public <T> T[] toArray(T[] arg0)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>


Copyright © 2013. All Rights Reserved.