Package com.consol.citrus.spi
Class ResourcePathTypeResolver
- java.lang.Object
-
- com.consol.citrus.spi.ResourcePathTypeResolver
-
- All Implemented Interfaces:
TypeResolver
public class ResourcePathTypeResolver extends Object implements TypeResolver
Type resolver resolves references via resource path lookup. Provided resource paths should point to a resource in classpath (e.g. META-INF/my/resource/path/file-name). The resolver will try to locate the resource as classpath resource and read the file as property file. By default the resolver reads the default type resolver propertyTypeResolver.DEFAULT_TYPE_PROPERTYand instantiates a new instance for the given type information. A possible property file content that represents the resource in classpath could look like this: type=com.consol.citrus.MySpecialPojo Users can define custom property names to read instead of the defaultTypeResolver.DEFAULT_TYPE_PROPERTY.- Author:
- Christoph Deppisch
-
-
Field Summary
-
Fields inherited from interface com.consol.citrus.spi.TypeResolver
DEFAULT_TYPE_PROPERTY, TYPE_PROPERTY_WILDCARD
-
-
Constructor Summary
Constructors Constructor Description ResourcePathTypeResolver()Default constructor using META-INF resource base path.ResourcePathTypeResolver(String resourceBasePath)Default constructor initializes with given resource path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tresolve(String resourcePath, String property, Object... initargs)Load given property from given resource path property file and create new instance of given type.<T> Map<String,T>resolveAll(String resourcePath, String property, String keyProperty)Load all resources in given resource path and create new instance of given type.StringresolveProperty(String resourcePath, String property)Resolve resource path property file with given name and load given property.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.consol.citrus.spi.TypeResolver
resolve, resolveAll, resolveAll, resolveAll
-
-
-
-
Constructor Detail
-
ResourcePathTypeResolver
public ResourcePathTypeResolver()
Default constructor using META-INF resource base path.
-
ResourcePathTypeResolver
public ResourcePathTypeResolver(String resourceBasePath)
Default constructor initializes with given resource path.- Parameters:
resourceBasePath-
-
-
Method Detail
-
resolveProperty
public String resolveProperty(String resourcePath, String property)
Description copied from interface:TypeResolverResolve resource path property file with given name and load given property.- Specified by:
resolvePropertyin interfaceTypeResolver- Returns:
-
resolve
public <T> T resolve(String resourcePath, String property, Object... initargs)
Description copied from interface:TypeResolverLoad given property from given resource path property file and create new instance of given type. The type information is read by the given property in the resource file.- Specified by:
resolvein interfaceTypeResolver- Returns:
-
resolveAll
public <T> Map<String,T> resolveAll(String resourcePath, String property, String keyProperty)
Description copied from interface:TypeResolverLoad all resources in given resource path and create new instance of given type. The type information is read by the given property in the resource file.- Specified by:
resolveAllin interfaceTypeResolver- Returns:
-
-