Class DefaultMatcher

java.lang.Object
org.simpleframework.xml.transform.DefaultMatcher
All Implemented Interfaces:
Matcher

class DefaultMatcher extends Object implements Matcher
The DefaultMatcher is a delegation object that uses several matcher implementations to correctly resolve both the stock Transform implementations and implementations that have been overridden by the user with a custom matcher. This will perform the resolution of the transform using the specified matcher, if this results in no transform then this will look for a transform within the collection of implementations.
See Also:
  • Field Details

    • primitive

      private Matcher primitive
      Matcher used to resolve stock transforms for primitive types.
    • matcher

      private Matcher matcher
      Matcher used to resolve user specified transform overrides.
    • stock

      private Matcher stock
      Matcher used to resolve all the core Java object transforms.
    • array

      private Matcher array
      Matcher used to resolve transforms for array type objects.
  • Constructor Details

    • DefaultMatcher

      public DefaultMatcher(Matcher matcher)
      Constructor for the DefaultMatcher object. This performs resolution of Transform implementations using the specified matcher. If that matcher fails to resolve a suitable transform then the stock implementations are used.
      Parameters:
      matcher - this is the user specified matcher object
  • Method Details

    • match

      public Transform match(Class type) throws Exception
      This is used to match a Transform for the given type. If a transform cannot be resolved this this will throw an exception to indicate that resolution of a transform failed. A transform is resolved by first searching for a transform within the user specified matcher then searching the stock transforms.
      Specified by:
      match in interface Matcher
      Parameters:
      type - this is the type to resolve a transform object for
      Returns:
      this returns a transform used to transform the type
      Throws:
      Exception
    • matchType

      private Transform matchType(Class type) throws Exception
      This is used to match a Transform for the given type. If a transform cannot be resolved this this will throw an exception to indicate that resolution of a transform failed. A transform is resolved by first searching for a transform within the user specified matcher then searching the stock transforms.
      Parameters:
      type - this is the type to resolve a transform object for
      Returns:
      this returns a transform used to transform the type
      Throws:
      Exception