|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AutowiredContainer<E>
An AutowiredContainer represents a high level container of objects which can be retrieved by the Class types
they are assignable to.
This results in the use of interfaces or classes as keys when object instances are put into the AutowiredContainer.
Usage example:
public interface ExampleInterface
{
}
public class Example extends ExampleInterface
{
}
{
Example example = new Example();
autowiredContainer.put( example );
assertEquals( 1, autowiredContainer.getValueSet( Example.class ).size() );
assertEquals( example, autowiredContainer.getValue( Example.class ) );
assertEquals( 1, autowiredContainer.getValueSet( ExampleInterface.class ).size() );
assertEquals( example, autowiredContainer.getValue( ExampleInterface.class ) );
}
AutowiredContainer the behavior of how many objects can be put into the
AutowiredContainer for the same Class type e.g. can differ.
AutowiredContainerUtils,
ListUtils.valueOf(Iterable),
SetUtils.valueOf(Iterable),
AutowiredContainerAbstract| Method Summary | ||
|---|---|---|
|
containsAssignable(Class<O> type)
Returns true if the current container contains any type which can be assigned to the given one. |
|
|
getValue(Class<? extends O> type)
Returns the value which can be assigned as value to the given Class type. |
|
|
getValueSet(Class<? extends O> type)
Returns a Set for all values which can be assigned to the given Class. |
|
boolean |
isEmpty()
Returns true if there are no elements within this container. |
|
AutowiredContainer<E> |
put(E object)
Adds an Object to the AutowiredContainer using its Object.getClass() as primary type. |
|
|
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. |
|
|
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. |
|
int |
size()
Returns the size of the AutowiredContainer |
|
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Method Detail |
|---|
<O extends E> O getValue(Class<? extends O> type)
Class type. If there are multiple values available with
fitting types null is returned.
O - type -
<O extends E> Set<O> getValueSet(Class<? extends O> type)
Set for all values which can be assigned to the given Class.
O - type - <O extends E> boolean containsAssignable(Class<O> type)
type -
boolean isEmpty()
AutowiredContainer<E> put(E object)
Object to the AutowiredContainer using its Object.getClass() as primary type.
object -
put(Object, Class...),
putAll(Iterable)AutowiredContainer<E> putAll(Iterable<E> iterable)
Objects to the AutowiredContainer.
iterable -
put(Object)
<O extends E> AutowiredContainer<E> put(O object,
Class<? extends O>... types)
Object to the AutowiredContainer for one or more given Class types.
object - types -
put(Object)<O extends E> AutowiredContainer<E> remove(O object)
AutowiredContainer
object -
AutowiredContainer<E> removeAllHavingExactTypeOf(Class<? extends E> type)
AutowiredContainer which are put into the container with the given primary type.
type -
removeAllAssignableTo(Class)AutowiredContainer<E> removeAllAssignableTo(Class<? extends E> type)
AutowiredContainer which are Class.isAssignableFrom(Class) to the given type.
type -
removeAllHavingExactTypeOf(Class)int size()
AutowiredContainer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||