类 TestContextResourceUtils
java.lang.Object
cn.taketoday.test.context.util.TestContextResourceUtils
Utility methods for working with resources within the Infra TestContext
Framework. Mainly for internal use within the framework.
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Tadaya Tsuyukubo
- 另请参阅:
-
ResourceUtilsResourceClassPathResourceFileSystemResourceUrlResourceResourceLoader
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String[]convertToClasspathResourcePaths(Class<?> clazz, boolean preservePlaceholders, String... paths) Convert the supplied paths to classpath resource paths.static String[]convertToClasspathResourcePaths(Class<?> clazz, String... paths) Convert the supplied paths to classpath resource paths.static List<cn.taketoday.core.io.Resource>convertToResourceList(cn.taketoday.core.io.ResourceLoader resourceLoader, String... paths) Convert the supplied paths to a list ofResourcehandles using the givenResourceLoader.static cn.taketoday.core.io.Resource[]convertToResources(cn.taketoday.core.io.ResourceLoader resourceLoader, String... paths) Convert the supplied paths to an array ofResourcehandles using the givenResourceLoader.private static Stream<cn.taketoday.core.io.Resource>
-
字段详细资料
-
SLASH
- 另请参阅:
-
PLACEHOLDER_PATTERN
-
-
构造器详细资料
-
TestContextResourceUtils
public TestContextResourceUtils()
-
-
方法详细资料
-
convertToClasspathResourcePaths
Convert the supplied paths to classpath resource paths.Delegates to
convertToClasspathResourcePaths(Class, boolean, String...)withfalsesupplied for thepreservePlaceholdersflag.- 参数:
clazz- the class with which the paths are associatedpaths- the paths to be converted- 返回:
- a new array of converted resource paths
- 另请参阅:
-
convertToClasspathResourcePaths
public static String[] convertToClasspathResourcePaths(Class<?> clazz, boolean preservePlaceholders, String... paths) Convert the supplied paths to classpath resource paths.For each of the supplied paths:
- A plain path — for example,
"context.xml"— will be treated as a classpath resource that is relative to the package in which the specified class is defined. Such a path will be prepended with theclasspath:prefix and the path to the package for the class. - A path starting with a slash will be treated as an absolute path
within the classpath, for example:
"/org/example/schema.sql". Such a path will be prepended with theclasspath:prefix. - A path which is already prefixed with a URL protocol (e.g.,
classpath:,file:,http:, etc.) will not have its protocol modified.
Each path will then be cleaned, unless the
preservePlaceholdersflag istrueand the path contains one or more placeholders in the form${placeholder.name}.- 参数:
clazz- the class with which the paths are associatedpreservePlaceholders-trueif placeholders should be preservedpaths- the paths to be converted- 返回:
- a new array of converted resource paths
- 另请参阅:
-
convertToResources(cn.taketoday.core.io.ResourceLoader, java.lang.String...)ResourceLoader.CLASSPATH_URL_PREFIXResourceUtils.FILE_URL_PREFIX
- A plain path — for example,
-
convertToResources
public static cn.taketoday.core.io.Resource[] convertToResources(cn.taketoday.core.io.ResourceLoader resourceLoader, String... paths) Convert the supplied paths to an array ofResourcehandles using the givenResourceLoader.- 参数:
resourceLoader- theResourceLoaderto use to convert the pathspaths- the paths to be converted- 返回:
- a new array of resources
- 另请参阅:
-
convertToResourceList
public static List<cn.taketoday.core.io.Resource> convertToResourceList(cn.taketoday.core.io.ResourceLoader resourceLoader, String... paths) Convert the supplied paths to a list ofResourcehandles using the givenResourceLoader.- 参数:
resourceLoader- theResourceLoaderto use to convert the pathspaths- the paths to be converted- 返回:
- a new list of resources
- 另请参阅:
-
stream
-