public class DefaultResourceManager extends Object implements ResourceManager
Modifier and Type | Field and Description |
---|---|
protected boolean |
firstCalled |
protected List<ResourceResolver> |
registeredResolvers |
Constructor and Description |
---|
DefaultResourceManager() |
DefaultResourceManager(List<? extends ResourceResolver> resolvers) |
DefaultResourceManager(ResourceResolver resolver) |
Modifier and Type | Method and Description |
---|---|
void |
addResourceResolver(ResourceResolver resolver)
Add a
ResourceResolver . |
void |
addResourceResolvers(Collection<? extends ResourceResolver> resolvers) |
InputStream |
getResourceAsStream(String name)
Open stream to resource.
|
List<ResourceResolver> |
getResourceResolvers()
Get all the currently registered resolvers.
|
protected void |
onFirstResolve() |
void |
removeResourceResolver(ResourceResolver resolver)
Remove a
ResourceResolver . |
<T> T |
resolveResource(String name,
Class<T> type)
Resolve a resource.
|
<T> T |
resolveResource(String name,
Class<T> type,
List<ResourceResolver> resolvers)
Resolve a resource with via a specified list of resovlers.
|
protected final List<ResourceResolver> registeredResolvers
protected boolean firstCalled
public DefaultResourceManager()
public DefaultResourceManager(ResourceResolver resolver)
public DefaultResourceManager(List<? extends ResourceResolver> resolvers)
protected void onFirstResolve()
public final <T> T resolveResource(String name, Class<T> type)
ResourceManager
ResourceResovler
objects until one
manages to resolve the resourceresolveResource
in interface ResourceManager
name
- name of resource to resolve.type
- type of resource to resolve.public final <T> T resolveResource(String name, Class<T> type, List<ResourceResolver> resolvers)
ResourceManager
resolveResource
in interface ResourceManager
name
- name of resource to resolve.type
- type of resource to resolve.resolvers
- list of ResourceResolvers to search.
public final InputStream getResourceAsStream(String name)
ResourceManager
getResourceAsStream
in interface ResourceManager
name
- name of resource to resolve.public final void addResourceResolver(ResourceResolver resolver)
ResourceManager
ResourceResolver
. The newly added resolver
is added at the head of the list so the most recently added
will be queried first.addResourceResolver
in interface ResourceManager
resolver
- the ResourceResolver
to
add. Duplicates will be ignored.public final void addResourceResolvers(Collection<? extends ResourceResolver> resolvers)
public final void removeResourceResolver(ResourceResolver resolver)
ResourceManager
ResourceResolver
.removeResourceResolver
in interface ResourceManager
resolver
- the ResourceResolver
to remove.
If not previously registered, it is ignored.public final List<ResourceResolver> getResourceResolvers()
ResourceManager
getResourceResolvers
in interface ResourceManager
Copyright © 2021 JBoss by Red Hat. All rights reserved.