import { ClassReference } from "./ClassReference"; import { AstNode } from "../core/AstNode"; import { Writer } from "../core/Writer"; import { GenericType } from "./GenericType"; /** * Union type of all available Java types in the AST. * This includes primitive types, wrapper types, collections, and custom types. */ type InternalType = IntType | LongType | ShortType | ByteType | FloatType | DoubleType | BooleanType | CharType | StringType | VoidType | DateType | LocalDateTimeType | ObjectType | ListType | SetType | MapType | OptionalType | ReferenceType | GenericReferenceType | ArrayType | BoxedIntType; /** Interface for primitive int type */ interface IntType { type: "int"; } /** Interface for boxed Integer type */ interface BoxedIntType { type: "boxed_int"; } /** Interface for primitive long type */ interface LongType { type: "long"; } /** Interface for primitive short type */ interface ShortType { type: "short"; } /** Interface for primitive byte type */ interface ByteType { type: "byte"; } /** Interface for primitive float type */ interface FloatType { type: "float"; } /** Interface for primitive double type */ interface DoubleType { type: "double"; } /** Interface for primitive boolean type */ interface BooleanType { type: "boolean"; } /** Interface for primitive char type */ interface CharType { type: "char"; } /** Interface for String type */ interface StringType { type: "string"; } /** Interface for void type */ interface VoidType { type: "void"; } /** Interface for LocalDate type */ interface DateType { type: "date"; } /** Interface for LocalDateTime type */ interface LocalDateTimeType { type: "localDateTime"; } /** Interface for Object type */ interface ObjectType { type: "object"; } /** Interface for List type with generic value type */ interface ListType { type: "list"; value: Type; } /** Interface for Set type with generic value type */ interface SetType { type: "set"; value: Type; } /** Interface for Map type with generic key and value types */ interface MapType { type: "map"; keyType: Type; valueType: Type; } /** Interface for Optional type with generic value type */ interface OptionalType { type: "optional"; value: Type; } /** Interface for class reference type */ interface ReferenceType { type: "reference"; value: ClassReference; } /** Interface for generic class reference type */ interface GenericReferenceType { type: "genericReference"; value: GenericType; } /** Interface for array type with component type */ interface ArrayType { type: "array"; componentType: Type; } /** * Represents a Java type in the AST. * This class handles the generation of all Java types including primitive types, * wrapper types, collections, arrays, and custom types. * * @class * @extends {AstNode} */ export declare class Type extends AstNode { readonly internalType: InternalType; /** * Creates a new Type instance with the specified internal type. * * @param {InternalType} internalType - The internal type representation * @private */ private constructor(); /** * Writes the type declaration to the writer. * This includes handling imports for non-primitive types and formatting * generic type parameters. * * @param {Writer} writer - The writer to write to */ write(writer: Writer): void; /** * Creates a primitive int type. * * @returns {Type} A new Type instance representing int */ static int(): Type; /** * Creates a boxed Integer type. * * @returns {Type} A new Type instance representing Integer */ static integer(): Type; /** * Creates a primitive long type. * * @returns {Type} A new Type instance representing long */ static long(): Type; /** * Creates a primitive short type. * * @returns {Type} A new Type instance representing short */ static short(): Type; /** * Creates a primitive byte type. * * @returns {Type} A new Type instance representing byte */ static byte(): Type; /** * Creates a primitive float type. * * @returns {Type} A new Type instance representing float */ static float(): Type; /** * Creates a primitive double type. * * @returns {Type} A new Type instance representing double */ static double(): Type; /** * Creates a primitive boolean type. * * @returns {Type} A new Type instance representing boolean */ static boolean(): Type; /** * Creates a primitive char type. * * @returns {Type} A new Type instance representing char */ static char(): Type; /** * Creates a String type. * * @returns {Type} A new Type instance representing String */ static string(): Type; /** * Creates a void type. * * @returns {Type} A new Type instance representing void */ static void(): Type; /** * Creates a void type (alias for void()). * * @returns {Type} A new Type instance representing void */ static void_(): Type; /** * Creates a LocalDate type. * * @returns {Type} A new Type instance representing LocalDate */ static date(): Type; /** * Creates a LocalDateTime type. * * @returns {Type} A new Type instance representing LocalDateTime */ static localDateTime(): Type; /** * Creates an Object type. * * @returns {Type} A new Type instance representing Object */ static object(): Type; /** * Creates a List type with the specified value type. * * @param {Type} value - The type of elements in the list * @returns {Type} A new Type instance representing List */ static list(value: Type): Type; /** * Creates a Set type with the specified value type. * * @param {Type} value - The type of elements in the set * @returns {Type} A new Type instance representing Set */ static set(value: Type): Type; /** * Creates a Map type with the specified key and value types. * * @param {Type} keyType - The type of map keys * @param {Type} valueType - The type of map values * @returns {Type} A new Type instance representing Map */ static map(keyType: Type, valueType: Type): Type; /** * Creates an Optional type with the specified value type. * * @param {Type} value - The type of the optional value * @returns {Type} A new Type instance representing Optional */ static optional(value: Type): Type; /** * Creates a reference type for a class. * * @param {ClassReference | (ClassReference.Args & { genericArgs?: Type[] })} value - The class reference or arguments to create one * @returns {Type} A new Type instance representing the class reference */ static reference(value: ClassReference | (ClassReference.Args & { genericArgs?: Type[]; })): Type; /** * Creates a generic reference type. * * @param {GenericType} value - The generic type * @returns {Type} A new Type instance representing the generic reference */ static genericReference(value: GenericType): Type; /** * Creates an array type with the specified component type. * * @param {Type} componentType - The type of array elements * @returns {Type} A new Type instance representing componentType[] */ static array(componentType: Type): Type; /** * Creates a wildcard type (?). * * @returns {Type} A new Type instance representing ? */ static wildcard(): Type; /** * Creates a wildcard type with an upper bound (? extends boundType). * * @param {Type} boundType - The upper bound type * @returns {Type} A new Type instance representing ? extends boundType */ static wildcardExtends(boundType: Type): Type; /** * Creates a wildcard type with a lower bound (? super boundType). * * @param {Type} boundType - The lower bound type * @returns {Type} A new Type instance representing ? super boundType */ static wildcardSuper(boundType: Type): Type; } export {};