Interface CtExecutable<R>

    • Field Detail

      • EXECUTABLE_SEPARATOR

        static final java.lang.String EXECUTABLE_SEPARATOR
        The separator for a string representation of an executable.
        See Also:
        Constant Field Values
    • Method Detail

      • getParameters

        java.util.List<CtParameter<?>> getParameters()
        Gets the parameters list.
      • setParameters

        <T extends CtExecutable<R>> T setParameters​(java.util.List<CtParameter<?>> parameters)
        Sets the parameters.
      • addParameter

        <T extends CtExecutable<R>> T addParameter​(CtParameter<?> parameter)
        Add a parameter for this executable
        Parameters:
        parameter -
        Returns:
        true if this element changed as a result of the call
      • addParameterAt

        <T extends CtExecutable<R>> T addParameterAt​(int position,
                                                     CtParameter<?> parameter)
        Add a parameter at a specific position in the executable.
        Parameters:
        position - index where the `parameter` needs to be inserted
        parameter - parameter to be inserted
        Returns:
        an object or sub-type of CtExecutable
      • removeParameter

        boolean removeParameter​(CtParameter<?> parameter)
        Remove a parameter for this executable
        Parameters:
        parameter -
        Returns:
        true if this element changed as a result of the call
      • getThrownTypes

        java.util.Set<CtTypeReference<? extends java.lang.Throwable>> getThrownTypes()
        Returns the exceptions and other throwables listed in this method or constructor's throws clause.
      • setThrownTypes

        <T extends CtExecutable<R>> T setThrownTypes​(java.util.Set<CtTypeReference<? extends java.lang.Throwable>> thrownTypes)
        Sets the thrown types.
      • addThrownType

        <T extends CtExecutable<R>> T addThrownType​(CtTypeReference<? extends java.lang.Throwable> throwType)
        add a thrown type.
        Parameters:
        throwType -
        Returns:
        true if this element changed as a result of the call
      • removeThrownType

        boolean removeThrownType​(CtTypeReference<? extends java.lang.Throwable> throwType)
        remove a thrown type.
        Parameters:
        throwType -
        Returns:
        true if this element changed as a result of the call
      • getSignature

        java.lang.String getSignature()
        Gets the signature of this method or constructor. The signature is composed of the method name and the parameter types, all fully-qualified, eg "int foo(java.lang.String)". The core contract is that in a type, there cannot be two methods with the same signature. Note that the concept of method signature in Java is not well defined (see chapter "8.4.2 Method Signature" of the Java specification, which defines what relations between signatures but not what a signature is exactly). Note also that the signature of a method reference is the same as the signature of the corresponding method if and only if the method parameters does not involve generics in their types. Otherwise, one has eg m(String) (reference) and m(T) (declaration) Reference: "In the Java programming language, a method signature is the method name and the number and type of its parameters. Return types and thrown exceptions are not considered to be a part of the method signature." see https://stackoverflow.com/questions/16149285/does-a-methods-signature-in-java-include-its-return-type see https://en.wikipedia.org/wiki/Type_signature
      • clone

        CtExecutable<R> clone()
        Description copied from interface: CtElement
        Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
        Specified by:
        clone in interface CtElement
        Specified by:
        clone in interface CtNamedElement