org.omnaest.utils.beans.autowired
Class AutowiredContainerDecorator<E>

java.lang.Object
  extended by org.omnaest.utils.beans.autowired.AutowiredContainerDecorator<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, Iterable<E>, AutowiredContainer<E>

public class AutowiredContainerDecorator<E>
extends Object
implements AutowiredContainer<E>

Decorator for an AutowiredContainer

Author:
Omnaest
See Also:
Serialized Form

Field Summary
protected  AutowiredContainer<E> autowiredContainer
           
 
Constructor Summary
protected AutowiredContainerDecorator()
           
  AutowiredContainerDecorator(AutowiredContainer<E> autowiredContainer)
           
 
Method Summary
<O extends E>
boolean
containsAssignable(Class<O> type)
          Returns true if the current container contains any type which can be assigned to the given one.
 boolean equals(Object obj)
           
protected  AutowiredContainer<E> getAutowiredContainer()
           
<O extends E>
O
getValue(Class<? extends O> type)
          Returns the value which can be assigned as value to the given Class type.
<O extends E>
Set<O>
getValueSet(Class<? extends O> type)
          Returns a Set for all values which can be assigned to the given Class.
 int hashCode()
           
 boolean isEmpty()
          Returns true if there are no elements within this container.
 Iterator<E> iterator()
           
 AutowiredContainer<E> put(E object)
          Adds an Object to the AutowiredContainer using its Object.getClass() as primary type.
<O extends E>
AutowiredContainer<E>
put(O object, Class<? extends O>... types)
          Adds an Object to the AutowiredContainer for one or more given Class types.
 AutowiredContainer<E> putAll(Iterable<E> iterable)
          Adds multiple Objects to the AutowiredContainer.
<O extends E>
AutowiredContainer<E>
remove(O object)
          Removes the given element from the AutowiredContainer
 AutowiredContainer<E> removeAllAssignableTo(Class<? extends E> type)
          Removes all elements within the AutowiredContainer which are Class.isAssignableFrom(Class) to the given type.
 AutowiredContainer<E> removeAllHavingExactTypeOf(Class<? extends E> type)
          Removes all elements within the AutowiredContainer which are put into the container with the given primary type.
protected  void setAutowiredContainer(AutowiredContainer<E> autowiredContainer)
           
 int size()
          Returns the size of the AutowiredContainer
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

autowiredContainer

protected AutowiredContainer<E> autowiredContainer
Constructor Detail

AutowiredContainerDecorator

public AutowiredContainerDecorator(AutowiredContainer<E> autowiredContainer)
Parameters:
autowiredContainer -
See Also:
AutowiredContainerDecorator

AutowiredContainerDecorator

protected AutowiredContainerDecorator()
See Also:
AutowiredContainerDecorator
Method Detail

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Returns:
See Also:
Iterable.iterator()

getValue

public <O extends E> O getValue(Class<? extends O> type)
Description copied from interface: AutowiredContainer
Returns the value which can be assigned as value to the given Class type. If there are multiple values available with fitting types null is returned.

Specified by:
getValue in interface AutowiredContainer<E>
Parameters:
type -
Returns:
See Also:
AutowiredContainer.getValue(java.lang.Class)

getValueSet

public <O extends E> Set<O> getValueSet(Class<? extends O> type)
Description copied from interface: AutowiredContainer
Returns a Set for all values which can be assigned to the given Class.

Specified by:
getValueSet in interface AutowiredContainer<E>
Parameters:
type -
Returns:
See Also:
AutowiredContainer.getValueSet(java.lang.Class)

containsAssignable

public <O extends E> boolean containsAssignable(Class<O> type)
Description copied from interface: AutowiredContainer
Returns true if the current container contains any type which can be assigned to the given one.

Specified by:
containsAssignable in interface AutowiredContainer<E>
Parameters:
type -
Returns:
See Also:
AutowiredContainer.containsAssignable(java.lang.Class)

isEmpty

public boolean isEmpty()
Description copied from interface: AutowiredContainer
Returns true if there are no elements within this container.

Specified by:
isEmpty in interface AutowiredContainer<E>
Returns:
See Also:
AutowiredContainer.isEmpty()

put

public AutowiredContainer<E> put(E object)
Description copied from interface: AutowiredContainer
Adds an Object to the AutowiredContainer using its Object.getClass() as primary type.

Specified by:
put in interface AutowiredContainer<E>
Parameters:
object -
Returns:
See Also:
AutowiredContainer.put(java.lang.Object)

putAll

public AutowiredContainer<E> putAll(Iterable<E> iterable)
Description copied from interface: AutowiredContainer
Adds multiple Objects to the AutowiredContainer.

Specified by:
putAll in interface AutowiredContainer<E>
Parameters:
iterable -
Returns:
See Also:
AutowiredContainer.putAll(java.lang.Iterable)

put

public <O extends E> AutowiredContainer<E> put(O object,
                                               Class<? extends O>... types)
Description copied from interface: AutowiredContainer
Adds an Object to the AutowiredContainer for one or more given Class types.

Specified by:
put in interface AutowiredContainer<E>
Parameters:
object -
types -
Returns:
See Also:
org.omnaest.utils.beans.autowired.AutowiredContainer#put(java.lang.Object, java.lang.Class[])

remove

public <O extends E> AutowiredContainer<E> remove(O object)
Description copied from interface: AutowiredContainer
Removes the given element from the AutowiredContainer

Specified by:
remove in interface AutowiredContainer<E>
Parameters:
object -
Returns:
See Also:
AutowiredContainer.remove(java.lang.Object)

removeAllHavingExactTypeOf

public AutowiredContainer<E> removeAllHavingExactTypeOf(Class<? extends E> type)
Description copied from interface: AutowiredContainer
Removes all elements within the AutowiredContainer which are put into the container with the given primary type.

Specified by:
removeAllHavingExactTypeOf in interface AutowiredContainer<E>
Parameters:
type -
Returns:
See Also:
AutowiredContainer.removeAllHavingExactTypeOf(java.lang.Class)

toString

public String toString()
Overrides:
toString in class Object

getAutowiredContainer

protected AutowiredContainer<E> getAutowiredContainer()
Returns:
the autowiredContainer

setAutowiredContainer

protected void setAutowiredContainer(AutowiredContainer<E> autowiredContainer)
Parameters:
autowiredContainer - the autowiredContainer to set

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

size

public int size()
Description copied from interface: AutowiredContainer
Returns the size of the AutowiredContainer

Specified by:
size in interface AutowiredContainer<E>
Returns:
See Also:
AutowiredContainer.size()

removeAllAssignableTo

public AutowiredContainer<E> removeAllAssignableTo(Class<? extends E> type)
Description copied from interface: AutowiredContainer
Removes all elements within the AutowiredContainer which are Class.isAssignableFrom(Class) to the given type.

Specified by:
removeAllAssignableTo in interface AutowiredContainer<E>
Returns:
this
See Also:
AutowiredContainer.removeAllHavingExactTypeOf(Class)


Copyright © 2013. All Rights Reserved.