import { Access } from "./Access"; import { Annotation } from "./Annotation"; import { ClassReference } from "./ClassReference"; import { AstNode } from "../core/AstNode"; import { Writer } from "../core/Writer"; import { Field } from "./Field"; import { Method } from "./Method"; import { Parameter } from "./Parameter"; import { Interface } from "./Interface"; import { CodeBlock } from "./CodeBlock"; import { Enum } from "./Enum"; /** * Namespace containing interfaces for Class configuration and constructor arguments. */ export declare namespace Class { /** * Interface defining the arguments required to create a new Class instance. * * @interface Args */ interface Args { /** The name of the Java class */ name: string; /** The package of the Java class */ packageName: string; /** The access level of the Java class */ access: Access; /** Whether the class is abstract */ abstract_?: boolean; /** Whether the class is final */ final_?: boolean; /** Whether the class is static (for nested classes) */ static_?: boolean; /** The class to extend, if any */ extends_?: ClassReference; /** Any interfaces the class implements */ implements_?: ClassReference[]; /** Whether this is a nested class */ isNestedClass?: boolean; /** Class annotations like @Entity, @RestController, etc. */ annotations?: Annotation[]; /** Documentation/JavaDoc for the class */ javadoc?: string; /** Generic type parameters for this class */ typeParameters?: string[]; } /** * Interface defining the structure of a constructor in a Java class. * * @interface Constructor */ interface Constructor { /** The body of the constructor */ body?: CodeBlock; /** The parameters of the constructor */ parameters: Parameter[]; /** The access level of the constructor */ access: Access; /** Documentation/JavaDoc for the constructor */ javadoc?: string; /** Constructor annotations */ annotations?: Annotation[]; /** Whether this constructor calls another constructor with super() */ superCall?: CodeBlock; /** Whether this constructor calls another constructor with this() */ thisCall?: CodeBlock; /** Exceptions thrown by this constructor */ throws?: ClassReference[]; } } /** * Represents a Java class in the AST. * This class handles the generation of Java class declarations including fields, * methods, constructors, and other class-related elements. * * @class * @extends {AstNode} */ export declare class Class extends AstNode { readonly name: string; readonly packageName: string; readonly access: Access; readonly abstract_: boolean; readonly final_: boolean; readonly static_: boolean; readonly reference: ClassReference; readonly isNestedClass: boolean; readonly extends_?: ClassReference; readonly implements_: ClassReference[]; private annotations; private javadoc?; private typeParameters; private fields; private constructors; private methods; private nestedClasses; private nestedInterfaces; private nestedEnums; /** * Creates a new Class instance with the specified configuration. * * @param {Class.Args} args - The arguments for creating the class */ constructor({ name, packageName, access, abstract_, final_, static_, extends_, implements_, isNestedClass, annotations, javadoc, typeParameters, }: Class.Args); /** * Adds a field to the class. * * @param {Field} field - The field to add */ addField(field: Field): void; /** * Adds a constructor to the class. * * @param {Class.Constructor} constructor - The constructor to add */ addConstructor(constructor: Class.Constructor): void; /** * Adds a method to the class. * * @param {Method} method - The method to add */ addMethod(method: Method): void; /** * Adds a nested class to the class. * * @param {Class} nestedClass - The nested class to add */ addNestedClass(nestedClass: Class): void; /** * Adds a nested interface to the class. * * @param {Interface} nestedInterface - The nested interface to add */ addNestedInterface(nestedInterface: Interface): void; /** * Adds a nested enum to the class. * * @param {Enum} nestedEnum - The nested enum to add */ addNestedEnum(nestedEnum: Enum): void; /** * Writes the class declaration and its contents to the writer. * This includes the class declaration, fields, constructors, methods, and nested types. * * @param {Writer} writer - The writer to write to */ write(writer: Writer): void; /** * Writes a constructor to the writer. * * @private * @param {Writer} writer - The writer to write to * @param {Class.Constructor} constructor - The constructor to write */ private writeConstructor; }