public class MatchingResources extends Object
PathMatchingResourcePatternResolver
.PathMatchingResourcePatternResolver
Constructor and Description |
---|
MatchingResources(String sPattern)
Initialize list of matching
Resource as found by
PathMatchingResourcePatternResolver.getResources(String) . |
Modifier and Type | Method and Description |
---|---|
org.springframework.core.io.Resource[] |
getAllMatches()
Get all matching resources
|
URL[] |
getAllMatchesURL()
Get all matching resources as URLs.
|
List<Class<?>> |
getAnnotatedMatches(Class<? extends Annotation> annotation)
Get all matching classes that are annotated with the given Annotation.
|
List<Class<?>> |
getAnnotatedMatches(Class<? extends Annotation> annotation,
boolean includeSubclasses)
Get all matching classes that are annotated with the given Annotation.
|
org.springframework.core.io.Resource |
getSingleRequiredResource()
Get a single required matching resource.
|
URL |
getSingleRequiredResourceURL()
Similar to
getSingleRequiredResource() , but returns result as an URL . |
org.springframework.core.io.Resource |
getSingleResource()
Get a single matching resource.
|
URL |
getSingleResourceURL()
Similar to
getSingleResource() , but returns result as an URL . |
URL |
getURL(org.springframework.core.io.Resource r)
Get URL from resource.
|
String |
toString() |
public MatchingResources(String sPattern)
Resource
as found by
PathMatchingResourcePatternResolver.getResources(String)
.sPattern
- the pattern to search forPathMatchingResourcePatternResolver
public org.springframework.core.io.Resource[] getAllMatches()
Resource
array of all matches. If no matches are found this is a
zero-length array.public URL[] getAllMatchesURL()
URL
array detemined by calling getURL(Resource)
on each resource.public List<Class<?>> getAnnotatedMatches(Class<? extends Annotation> annotation, boolean includeSubclasses)
annotation
- an annotation classincludeSubclasses
- if true, this will also return classes whose superclass has the specified
annotationpublic List<Class<?>> getAnnotatedMatches(Class<? extends Annotation> annotation)
annotation
- an annotation classgetAnnotatedMatches(Class, boolean)
public org.springframework.core.io.Resource getSingleResource()
Resource
RuntimeException
- if more than one Resource
was foundpublic URL getSingleResourceURL()
getSingleResource()
, but returns result as an URL
.Resource
as an URL
RuntimeException
- if more than one Resource
was foundpublic org.springframework.core.io.Resource getSingleRequiredResource()
Resource
RuntimeException
- if zero or more than one Resource
was foundpublic URL getSingleRequiredResourceURL()
getSingleRequiredResource()
, but returns result as an URL
.Resource
as an URL
RuntimeException
- if zero or more than one Resource
was foundpublic URL getURL(org.springframework.core.io.Resource r)
r
- a Resource
RuntimeException
- if Resource.getURL()
throws IOException
Copyright © 2015. All rights reserved.