public interface ResourceManager extends Manager
Resource
instances.Modifier and Type | Method and Description |
---|---|
<L extends Listener> |
assignables(java.lang.Class<L> type)
Returns a set of resources assignable to the specified listener type.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this manager for equality.
|
int |
hashCode()
Returns the hash code value for this manager.
|
<L extends Listener> |
register(java.lang.Class<L> type,
Resource<? super L> resource)
Registers a resource with the given listener type.
|
boolean |
registered(java.lang.Class<? extends Listener> type,
Resource<?> resource)
Determines whether the specified resource is registered
with the specified listener type by this resource manager.
|
<L extends Listener> |
registrables(java.lang.Class<L> type)
Returns a set of resources registrable with the specified listener type.
|
com.google.common.collect.SetMultimap<java.lang.Class<? extends Listener>,Resource<?>> |
registrations()
Returns a set multimap of listener types to all registered resources.
|
<L extends Listener> |
unregister(java.lang.Class<L> type,
Resource<? super L> resource)
Unregisters a resource with the given listener type.
|
<L extends Listener> |
unregisterAll(java.lang.Class<L> type)
Unregisters all resources assignable to the specified listener type.
|
<L extends Listener> void register(java.lang.Class<L> type, Resource<? super L> resource)
Note that this method propagates any exception
thrown by the specified resource as a cause of a
ResourceRegistrationException
instance.
type
- the listener type with which the specified
resource is to be registered, not null
resource
- the resource to be registered with the specified
listener type, not null
java.lang.IllegalArgumentException
- if the specified resource
implementation does not support the specified listener typeResourceAlreadyRegistredException
- if the specified listener
type and resource pair is already registered and this resource
manager panicsResourceRegistrationException
- if an exception is thrown
by the specified resource during the registration processjava.lang.NullPointerException
- if either of listener type or resource
is null
<L extends Listener> void unregister(java.lang.Class<L> type, Resource<? super L> resource)
Note that this method propagates any exception
thrown by the specified resource as a cause of a
ResourceUnregistrationException
instance.
type
- the listener type with which the specified
resource is to be unregistered, not null
resource
- the resource to be unregistered from the specified
listener type, not null
java.lang.IllegalArgumentException
- if the specified resource
implementation does not support the specified listener typeResourceNotRegistredException
- if the specified listener
type and resource pair is not registered and this resource
manager panicsResourceUnregistrationException
- if an exception is thrown
by the specified resource during the unregistration processjava.lang.NullPointerException
- if either of listener type or resource
is null
<L extends Listener> void unregisterAll(java.lang.Class<L> type)
Note that this method collects all exceptions thrown by resources
during the unregistration process and propagates them as suppressed
exceptions of a ResourceUnregistrationException
instance.
type
- the listener type to which the assignable resources
are going be unregistered, not null
ResourceUnregistrationException
- if an exception is thrown
by one or more resources during the unregistration processjava.lang.NullPointerException
- if the specified listener
type is null
<L extends Listener> java.util.Set<Resource<? extends L>> assignables(java.lang.Class<L> type)
A resource is assignable to a given listener type if the listener type supported by the resource is assignable to the given listener type.
<L extends Listener> java.util.Set<Resource<? super L>> registrables(java.lang.Class<L> type)
A resource is registrable with a given listener type if the listener type supported by the resource is equal to the given listener type or one of its superinterfaces.
com.google.common.collect.SetMultimap<java.lang.Class<? extends Listener>,Resource<?>> registrations()
boolean registered(java.lang.Class<? extends Listener> type, Resource<?> resource)
type
- the listener type to be checked, not null
resource
- the resource to be checked, not null
true
if the specified resource is registered
with the specified listener type by this resource manager,
false
otherwisejava.lang.NullPointerException
- if either of listener type or resource
is null
boolean equals(@Nullable java.lang.Object o)
true
if the specified object is also manager
and the two managers have the same name. This definition ensures
that this method works properly across different implementations
of the manager interface.