Class DefaultMatcher

  • All Implemented Interfaces:
    Matcher

    class DefaultMatcher
    extends java.lang.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:
    Transformer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Matcher array
      Matcher used to resolve transforms for array type objects.
      private Matcher matcher
      Matcher used to resolve user specified transform overrides.
      private Matcher primitive
      Matcher used to resolve stock transforms for primitive types.
      private Matcher stock
      Matcher used to resolve all the core Java object transforms.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultMatcher​(Matcher matcher)
      Constructor for the DefaultMatcher object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Transform match​(java.lang.Class type)
      This is used to match a Transform for the given type.
      private Transform matchType​(java.lang.Class type)
      This is used to match a Transform for the given type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • 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 Detail

      • match

        public Transform match​(java.lang.Class type)
                        throws java.lang.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:
        java.lang.Exception
      • matchType

        private Transform matchType​(java.lang.Class type)
                             throws java.lang.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:
        java.lang.Exception