Interface CtMethod<T>

    • Method Detail

      • isOverriding

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

        boolean isDefaultMethod()
        Checks if the method is a default method. Default method can be in interfaces from Java 8: http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html.
      • setDefaultMethod

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

        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)