Class RegistryMatcher
java.lang.Object
org.simpleframework.xml.transform.RegistryMatcher
- All Implemented Interfaces:
Matcher
The
RegistryMatcher
provides a simple matcher backed
by a registry. Registration can be done to match a type to a
Transform
class or instance. If a transform class is
registered an instance of it is created when requested using the
default no argument constructor of the type, it is then cached so
it can be reused on future requests.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This is used to bind aTransform
type.void
This is used to bind aTransform
instance to the specified type.private Transform
This is used to create aTransform
using the type specified.private Transform
This is used to create aTransform
using the type specified.This is used to match aTransform
using the type specified.
-
Field Details
-
transforms
This is used to fetch transform instances by type. -
types
This is used to determine the transform for a type.
-
-
Constructor Details
-
RegistryMatcher
public RegistryMatcher()Constructor for theRegistryMatcher
. This is used to create a matcher instance that can resolve a transform by type and can also instantiate new transforms if required. It is essentially a convenience implementation.
-
-
Method Details
-
bind
This is used to bind aTransform
type. The first time a transform is requested for the specified type a new instance of thisTransform
will be instantiated.- Parameters:
type
- this is the type to resolve the transform fortransform
- this is the transform type to instantiate
-
bind
This is used to bind aTransform
instance to the specified type. Each time a transform is requested for this type the provided instance will be returned.- Parameters:
type
- this is the type to resolve the transform fortransform
- this transform instance to be used
-
match
This is used to match aTransform
using the type specified. If no transform can be acquired then this returns a null value indicating that no transform could be found. -
create
This is used to create aTransform
using the type specified. If no transform can be acquired then this returns a null value indicating that no transform could be found.- Parameters:
type
- this is the type to acquire the transform for- Returns:
- returns a transform for processing the type given
- Throws:
Exception
-
create
This is used to create aTransform
using the type specified. If the transform can not be instantiated then this will throw an exception. If it can then it is cached.- Parameters:
type
- this is the type to acquire the transform forfactory
- the class for instantiating the transform- Returns:
- returns a transform for processing the type given
- Throws:
Exception
-