Interface CtMethod<T>

    • Method Detail

      • isOverriding

        boolean isOverriding​(CtMethod<?> superMethod)
        superMethod - to be checked method
        true if this method overrides `superMethod`.
        Returns true for itself too.
      • isDefaultMethod

        boolean isDefaultMethod()
        Checks if the method is a default method. Default method can be in interfaces from Java 8:
      • setDefaultMethod

        <C extends CtMethod<T>> C setDefaultMethod​(boolean defaultMethod)
        Sets the default value state of a method.
      • getTopDefinitions

        java.util.Collection<CtMethod<?>> getTopDefinitions()
        Returns the top-most methods in the hierarchy defining this method (in super class and super interfaces). Returns the empty collection if defined here for the first time.
      • copyMethod

        CtMethod<?> copyMethod()
        Copy the method, where copy means cloning + porting all the references of the old method to the new method (important for recursive methods). The copied method is added to the type, with a suffix "Copy". A new unique method name is given for each copy, and this method can be called several times. If you want to rename the new method, use Refactoring.changeMethodName(CtMethod, String) (and not CtNamedElement.setSimpleName(String), which does not update the references)