public class RegistryMatcher extends Object implements Matcher
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.Persister
Constructor and Description |
---|
RegistryMatcher()
Constructor for the
RegistryMatcher . |
Modifier and Type | Method and Description |
---|---|
void |
bind(Class type,
Class transform)
This is used to bind a
Transform type. |
void |
bind(Class type,
Transform transform)
This is used to bind a
Transform instance to the
specified type. |
Transform |
match(Class type)
This is used to match a
Transform using the type
specified. |
public RegistryMatcher()
RegistryMatcher
. 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.public void bind(Class type, Class transform)
Transform
type. The first
time a transform is requested for the specified type a new
instance of this Transform
will be instantiated.type
- this is the type to resolve the transform fortransform
- this is the transform type to instantiatepublic void bind(Class type, Transform transform)
Transform
instance to the
specified type. Each time a transform is requested for this
type the provided instance will be returned.type
- this is the type to resolve the transform fortransform
- this transform instance to be used