Enum Class CtImportKind
- All Implemented Interfaces:
Serializable,Comparable<CtImportKind>,Constable
This enum represents both traditional package imports (from Java source files) and module imports
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA static on-demand import declaration for all static members of a type.An on-demand import declaration for all types in a package.A static import declaration for a single static field.A static import declaration for all static methods with this name.A module import declaration for all public types of a Java module.A single type import declaration.An import that cannot be resolved to a specific kind. -
Method Summary
Modifier and TypeMethodDescriptionstatic CtImportKindReturns the enum constant of this class with the specified name.static CtImportKind[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TYPE
A single type import declaration.Example:
import my.package.Type;This allows referencing the type by its simple name instead of its fully-qualified name.
-
ALL_TYPES
An on-demand import declaration for all types in a package.Example:
import my.package.*;This makes all public types in the specified package available using their simple names.
-
ALL_STATIC_MEMBERS
A static on-demand import declaration for all static members of a type.Example:
import static my.package.Type.*;This makes all static members (fields, methods, and nested types) of the specified type available without qualifying them with the type name.
-
FIELD
A static import declaration for a single static field.Example:
import static my.package.Type.f;This allows referencing the static field by its simple name within the importing compilation unit.
-
METHOD
A static import declaration for all static methods with this name.Example:
import static my.package.Type.m;This allows calling a static method by its simple name within the importing compilation unit.
-
UNRESOLVED
An import that cannot be resolved to a specific kind.This kind is used when Spoon operates in no-classpath mode and the reference cannot be resolved. In such cases, the import is stored as a plain string and printed as-is during pretty printing. The original import statement is preserved without semantic analysis.
-
MODULE
A module import declaration for all public types of a Java module.Example:
import module java.base;
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-