Class PackageMatcher

  • All Implemented Interfaces:
    Matcher

    class PackageMatcher
    extends java.lang.Object
    implements Matcher
    The PackageMatcher object is used to match the stock transforms to Java packages. This is used to match useful types from the java.lang and java.util packages as well as other Java packages. This matcher groups types by their package names and attempts to search the stock transforms for a suitable match. If no match can be found this throws an exception.
    See Also:
    DefaultMatcher
    • Constructor Summary

      Constructors 
      Constructor Description
      PackageMatcher()
      Constructor for the PackageMatcher object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Transform match​(java.lang.Class type)
      This method attempts to perform a resolution of the transform based on its package prefix.
      private Transform matchEnum​(java.lang.Class type)
      This is used to resolve Transform implementations that are Enum implementations.
      private Transform matchFile​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.io package.
      private Transform matchLanguage​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.lang package.
      private Transform matchMath​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.math package.
      private Transform matchSQL​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.sql package.
      private Transform matchURL​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.net package.
      private Transform matchUtility​(java.lang.Class type)
      This is used to resolve Transform implementations that relate to the java.util package.
      • Methods inherited from class java.lang.Object

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

      • PackageMatcher

        public PackageMatcher()
        Constructor for the PackageMatcher object. The package matcher is used to resolve a transform instance to convert object types to an from strings. If a match cannot be found with this matcher then an exception is thrown.
    • Method Detail

      • match

        public Transform match​(java.lang.Class type)
                        throws java.lang.Exception
        This method attempts to perform a resolution of the transform based on its package prefix. This allows this matcher to create a logical group of transforms within a single method based on the types package prefix. If no transform can be found then this will throw an exception.
        Specified by:
        match in interface Matcher
        Parameters:
        type - this is the type to resolve a transform for
        Returns:
        the transform that is used to transform that type
        Throws:
        java.lang.Exception
      • matchEnum

        private Transform matchEnum​(java.lang.Class type)
        This is used to resolve Transform implementations that are Enum implementations. If the type is not an enumeration then this will return null.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
      • matchLanguage

        private Transform matchLanguage​(java.lang.Class type)
                                 throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.lang package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception
      • matchMath

        private Transform matchMath​(java.lang.Class type)
                             throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.math package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception
      • matchUtility

        private Transform matchUtility​(java.lang.Class type)
                                throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.util package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception
      • matchSQL

        private Transform matchSQL​(java.lang.Class type)
                            throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.sql package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception
      • matchFile

        private Transform matchFile​(java.lang.Class type)
                             throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.io package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception
      • matchURL

        private Transform matchURL​(java.lang.Class type)
                            throws java.lang.Exception
        This is used to resolve Transform implementations that relate to the java.net package. If the type does not resolve to a valid transform then this method will throw an exception to indicate that no stock transform exists for the specified type.
        Parameters:
        type - this is the type to resolve a stock transform for
        Returns:
        this will return a transform for the specified type
        Throws:
        java.lang.Exception