public interface ResourceProvider extends Provider
Resource
instances.Modifier and Type | Interface and Description |
---|---|
static interface |
ResourceProvider.Builder
A builder for creating resource provider instances.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Compares the specified object with this provider for equality.
|
Resource<?> |
forName(java.lang.String name)
Returns a resource with the specified name.
|
<L extends Listener> |
forType(java.lang.Class<L> type)
Returns a set of resources supporting the specified listener type.
|
int |
hashCode()
Returns the hash code value for this provider.
|
java.util.Set<java.lang.String> |
names()
Returns names of all provided resources.
|
ResourceProvider |
parent()
Returns the resource provider's parent or
null if there is no
parent. |
java.util.Set<java.lang.Class<? extends Listener>> |
types()
Returns listener types supported by provided resources.
|
Resource<?> forName(java.lang.String name)
This method is guaranteed to return the same resource instance for the specified resource name every time it is invoked.
name
- the resource name, not an empty string or null
Resource
objectjava.lang.IllegalArgumentException
- if the specified resource name
is an empty stringjava.lang.NullPointerException
- if the specified resource name
is null
ResourceNotFoundException
- if no definition of the resource
could be found by the specified nameIllegalResourceClassException
- if the resource implementation
class is invalidResourceInstantiationException
- if the resource instantiation
failed<L extends Listener> java.util.Set<Resource<L>> forType(java.lang.Class<L> type)
type
- the listener type, not null
java.lang.NullPointerException
- if the specified listener type
is null
ResourceNotFoundException
- if no definition of the resource
could be found by the specified nameIllegalResourceClassException
- if the resource implementation
class is invalidResourceInstantiationException
- if the resource instantiation
failedjava.util.Set<java.lang.String> names()
java.util.Set<java.lang.Class<? extends Listener>> types()
ResourceProvider parent()
null
if there is no
parent. Standard implementations should return system resource provider
if there is no direct parent (only the system resource provider returns
null
as it is at the top of the resource provider hierarchy).parent
in interface Provider
ResourceProviders.superResourceProvider()
boolean equals(@Nullable java.lang.Object o)
true
if the specified object is also provider
and the two providers have the same name. This definition ensures
that this method works properly across different implementations
of the provider interface.