Package org.citrusframework.spi
Class ResourcePathTypeResolver
java.lang.Object
org.citrusframework.spi.ResourcePathTypeResolver
- All Implemented Interfaces:
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 property
TypeResolver.DEFAULT_TYPE_PROPERTY and
instantiates a new instance for the given type information. Note that, in order to reduce classpath
scanning, the resolver caches the results of specific classpath scans.
A possible property file content that represents the resource in classpath could look like this:
type=org.citrusframework.MySpecialPojo
Users can define custom property names to read instead of the default
TypeResolver.DEFAULT_TYPE_PROPERTY.
Users can define custom property names to read instead of the default TypeResolver.DEFAULT_TYPE_PROPERTY.
- Author:
- Christoph Deppisch
-
Field Summary
Fields inherited from interface org.citrusframework.spi.TypeResolver
DEFAULT_TYPE_PROPERTY, TYPE_PROPERTY_WILDCARD -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using META-INF resource base path.ResourcePathTypeResolver(String resourceBasePath) Default constructor initializes with given resource path. -
Method Summary
Modifier and TypeMethodDescription<T> TinstantiateType(String type, Object... initargs) Instantiate a type by its name.<T> TLoad given property from given resource path property file and create new instance of given type.resolveAll(String path, String property, String keyProperty) Load all resources in given resource path and create new instance of given type.resolveProperty(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, waitMethods inherited from interface org.citrusframework.spi.TypeResolver
resolve, resolveAll, resolveAll, resolveAll
-
Constructor Details
-
ResourcePathTypeResolver
public ResourcePathTypeResolver()Default constructor using META-INF resource base path. -
ResourcePathTypeResolver
Default constructor initializes with given resource path.- Parameters:
resourceBasePath-
-
-
Method Details
-
resolveProperty
Description copied from interface:TypeResolverResolve resource path property file with given name and load given property.- Specified by:
resolvePropertyin interfaceTypeResolver- Returns:
-
resolve
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
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:
-
instantiateType
Instantiate a type by its name.
-