import { Access } from "./Access"; import { Annotation } from "./Annotation"; import { ClassReference } from "./ClassReference"; import { CodeBlock } from "./CodeBlock"; import { AstNode } from "../core/AstNode"; import { Writer } from "../core/Writer"; import { Parameter } from "./Parameter"; import { Type } from "./Type"; /** * Enumeration of possible method types in Java. * Defines the different categories of methods that can be created. * * @enum {number} */ export declare enum MethodType { /** Regular instance method */ INSTANCE = 0, /** Static method that belongs to the class */ STATIC = 1, /** Abstract method that must be implemented by subclasses */ ABSTRACT = 2, /** Default method in an interface */ DEFAULT = 3 } /** * Namespace containing interfaces for Method configuration. */ export declare namespace Method { /** * Interface defining the arguments required to create a new Method instance. * * @interface Args */ interface Args { /** The name of the Java method */ name: string; /** The access level of the method (public, private, protected) */ access: Access; /** The parameters of the method */ parameters?: Parameter[]; /** The return type of the method */ returnType?: Type; /** The body of the method containing the implementation */ body?: CodeBlock; /** Method annotations like @Override, @GetMapping, etc. */ annotations?: Annotation[]; /** Documentation/JavaDoc for the method */ javadoc?: string; /** The type of the method (instance, static, abstract, default) */ type?: MethodType; /** Whether this method is static */ static_?: boolean; /** Whether this method is abstract */ abstract_?: boolean; /** The class this method belongs to, if any */ classReference?: ClassReference; /** Whether this method is final */ final_?: boolean; /** Whether this method is synchronized */ synchronized_?: boolean; /** Exceptions thrown by this method */ throws?: ClassReference[]; /** Generic type parameters for this method */ typeParameters?: string[]; } } /** * Represents a Java method in the AST. * This class handles the generation of Java method declarations including parameters, * return type, body, and other method-related elements. * * @class * @extends {AstNode} */ export declare class Method extends AstNode { /** The name of the method */ readonly name: string; /** The access level of the method */ readonly access: Access; /** The parameters of the method */ private parameters; /** The return type of the method */ private returnType?; /** The body of the method */ private body?; /** The annotations applied to the method */ private annotations; /** The JavaDoc documentation for the method */ private javadoc?; /** The type of the method (instance, static, abstract, default) */ private type; /** The class this method belongs to */ private classReference?; /** Whether this method is final */ private final_; /** Whether this method is synchronized */ private synchronized_; /** The exceptions thrown by this method */ private throws; /** The generic type parameters for this method */ private typeParameters; /** * Creates a new Method instance with the specified configuration. * * @param {Method.Args} args - The arguments for creating the method */ constructor({ name, access, parameters, returnType, body, annotations, javadoc, type, static_, abstract_, classReference, final_, synchronized_, throws, typeParameters, }: Method.Args); /** * Adds a parameter to the method. * * @param {Parameter} parameter - The parameter to add */ addParameter(parameter: Parameter): void; /** * Sets the method body. * * @param {CodeBlock} body - The code block containing the method body * @returns {Method} This Method instance for method chaining */ setBody(body: CodeBlock): Method; /** * Writes the method declaration and its contents to the writer. * This includes JavaDoc, annotations, method signature, parameters, return type, * and method body. The method handles all Java method modifiers including static, * abstract, final, and synchronized. * * @param {Writer} writer - The writer to write to */ write(writer: Writer): void; }