Class ClassComparer


  • public class ClassComparer
    extends java.lang.Object
    This class will compare the method signatures between two classes. The comparison can be based on the following method information:

    • Method Name
    • Method Name + Parameter Types
    • Method Name + Return Type
    • Method Name + Parameter Types + Return Type

    The operations that can be used to compare the method signatures of two classes are:

    • Intersection
    • Difference
    • Symmetric difference
    • isProperSubsetOf
    • isProperSupersetOf
    • Field Detail

      • SYMMETRIC_DIFFERENCE

        private static final java.lang.String SYMMETRIC_DIFFERENCE
        See Also:
        Constant Field Values
      • includeParameterTypesInMethods

        private final boolean includeParameterTypesInMethods
      • includeReturnTypes

        private final boolean includeReturnTypes
      • includePackageNames

        private final boolean includePackageNames
      • includeObjectMethods

        private boolean includeObjectMethods
      • appendable

        private final java.lang.Appendable appendable
    • Constructor Detail

      • ClassComparer

        public ClassComparer()
      • ClassComparer

        public ClassComparer​(java.lang.Appendable out)
      • ClassComparer

        public ClassComparer​(boolean includeParameterTypesInMethods,
                             boolean includeReturnTypes,
                             boolean includePackageNames)
      • ClassComparer

        public ClassComparer​(java.lang.Appendable out,
                             boolean includeParameterTypesInMethods,
                             boolean includeReturnTypes,
                             boolean includePackageNames)
    • Method Detail

      • isProperSupersetOf

        public static boolean isProperSupersetOf​(java.lang.Class<?> supersetClass,
                                                 java.lang.Class<?> subsetClass)
      • isProperSubsetOf

        public static boolean isProperSubsetOf​(java.lang.Class<?> subsetClass,
                                               java.lang.Class<?> supersetClass)
      • compare

        public Triplet<MutableSortedSet<java.lang.String>> compare​(java.lang.Class<?> leftClass,
                                                                   java.lang.Class<?> rightClass)
      • difference

        public MutableSortedSet<java.lang.String> difference​(java.lang.Class<?> leftClass,
                                                             java.lang.Class<?> rightClass)
      • printDifference

        public MutableSortedSet<java.lang.String> printDifference​(java.lang.Class<?> leftClass,
                                                                  java.lang.Class<?> rightClass)
      • symmetricDifference

        public MutableSortedSet<java.lang.String> symmetricDifference​(java.lang.Class<?> leftClass,
                                                                      java.lang.Class<?> rightClass)
      • printSymmetricDifference

        public MutableSortedSet<java.lang.String> printSymmetricDifference​(java.lang.Class<?> leftClass,
                                                                           java.lang.Class<?> rightClass)
      • intersect

        public MutableSortedSet<java.lang.String> intersect​(java.lang.Class<?> leftClass,
                                                            java.lang.Class<?> rightClass)
      • printIntersection

        public MutableSortedSet<java.lang.String> printIntersection​(java.lang.Class<?> leftClass,
                                                                    java.lang.Class<?> rightClass)
      • printClass

        public MutableSortedSet<java.lang.String> printClass​(java.lang.Class<?> clazz)
      • compareAndPrint

        public Triplet<MutableSortedSet<java.lang.String>> compareAndPrint​(java.lang.Class<?> leftClass,
                                                                           java.lang.Class<?> rightClass)
      • output

        private void output​(Twin<java.lang.Class<?>> classPair,
                            java.lang.String operation,
                            RichIterable<java.lang.String> strings)
      • classNames

        private java.lang.String classNames​(Twin<java.lang.Class<?>> classPair)
      • getMethodNames

        public MutableSortedSet<java.lang.String> getMethodNames​(java.lang.Class<?> classOne)
      • includeObjectMethods

        public void includeObjectMethods()
      • includeMethod

        private boolean includeMethod​(java.lang.reflect.Method method)
      • methodName

        private java.lang.String methodName​(java.lang.reflect.Method method)
      • parameterNames

        private java.lang.String parameterNames​(java.lang.reflect.Method method)
      • outputTitle

        private void outputTitle​(java.lang.String title)
      • outputGroupByToString

        private void outputGroupByToString​(RichIterable<java.lang.String> methods)