Class ClassValidator

java.lang.Object
com.yahoo.protect.ClassValidator

public final class ClassValidator extends Object
Static utility methods to validate class properties.

Do note, this class will not be a reliable guarantee for correctness if you have a forest of methods only differing by return type (as contradistinguished from name and argument types), the current implementation is minimal.

Author:
Steinar Knutsen
  • Constructor Details

    • ClassValidator

      public ClassValidator()
  • Method Details

    • unmaskedMethods

      public static List<Method> unmaskedMethods(Class<?> testClass, Class<?> maskedClass)
      Check all protected, public and package private declared methods of maskedClass is implemented in testClass. Note, this will by definition blow up on final methods in maskedClass.
      Parameters:
      testClass - class which wraps or masks another class
      maskedClass - class which is masked or wrapped
      Returns:
      the methods which seem to miss from testClass to be complete
    • unmaskedMethodsFromSuperclass

      public static List<Method> unmaskedMethodsFromSuperclass(Class<?> testClass)
      Check testClass overrides all protected, public and package private methods of its immediate super class. See unmaskedMethods().
      Parameters:
      testClass - the class to check whether completely masks its super class
      Returns:
      the methods missing from testClass to completely override its immediate super class