- All Superinterfaces:
AnnotatableCreator,GenericTyped,ModifiableCreator,SimpleTyped,Typed
- All Known Subinterfaces:
AnonymousClassCreator,ClassCreator,InterfaceCreator
public sealed interface TypeCreator
extends ModifiableCreator, GenericTyped
permits ClassCreator, InterfaceCreator (not exhaustive)
A creator for a type.
-
Method Summary
Modifier and TypeMethodDescriptiondefault StaticFieldVarconstantField(String name, Const value) Add a public static final field to this type.Returns a list of descriptors of all constructors added to this class so far.Returns the generic type of this class.Returns a list of descriptors of all instance fields added to this class so far.Returns a list of descriptors of all instance methods added to this class so far.voidsetVersion(ClassVersion version) Set the class file version.voidsetVersion(Runtime.Version version) Set the class file version to correspond with a run time version.voidsourceFile(String name) Set the source file name for this type.default StaticFieldVarstaticField(String name, Const initial) Add a static field to this type.staticField(String name, Consumer<StaticFieldCreator> builder) Add a static field to this type.Returns a list of descriptors of all static fields added to this class so far.voidstaticInitializer(Consumer<BlockCreator> builder) Add a general static initializer block to the type.default MethodDescstaticMethod(MethodDesc desc, Consumer<StaticMethodCreator> builder) Add a static method to this type having the same name and type as the given method.default MethodDescstaticMethod(String name, MethodTypeDesc type, Consumer<StaticMethodCreator> builder) Add a static method to this type having the given predefined method type.staticMethod(String name, Consumer<StaticMethodCreator> builder) Add a static method to this type.Returns a list of descriptors of all static methods added to this class so far.stringListResourceConstant(String name, List<String> items) Create a private constant which loads the given list of strings from a generated resource file.stringMapResourceConstant(String name, Map<String, String> items) Create a private constant which loads the given map of strings from a generated resource file.stringSetResourceConstant(String name, Set<String> items) Create a private constant which loads the given set of strings from a generated resource file.this_()Returns thethisexpression.type()Returns the descriptor of the type of this class.Methods inherited from interface io.quarkus.gizmo2.creator.AnnotatableCreator
addAnnotation, addAnnotation, addAnnotation, addAnnotationMethods inherited from interface io.quarkus.gizmo2.GenericTyped
hasGenericTypeMethods inherited from interface io.quarkus.gizmo2.creator.ModifiableCreator
addFlag, addFlags, addFlags, final_, modifierLocation, packagePrivate, private_, protected_, public_, removeFlag, removeFlags, removeFlags, setAccess, supports, syntheticMethods inherited from interface io.quarkus.gizmo2.SimpleTyped
isPrimitive, isVoid, slotSize, typeKind
-
Method Details
-
setVersion
Set the class file version to correspond with a run time version. If not called, the generated class has the version of Java 17.- Parameters:
version- the run time version (must not benull)
-
setVersion
Set the class file version. If not called, the generated class has the version of Java 17.- Parameters:
version- the class file version (must not benull)
-
sourceFile
Set the source file name for this type.- Parameters:
name- the source file name (must not benull)
-
type
ClassDesc type()Returns the descriptor of the type of this class.- Specified by:
typein interfaceSimpleTyped- Specified by:
typein interfaceTyped- Returns:
- the descriptor of the type of this class
-
genericType
GenericType.OfClass genericType()Returns the generic type of this class.- Specified by:
genericTypein interfaceGenericTyped- Returns:
- the generic type of this class
-
staticInitializer
Add a general static initializer block to the type. A type may have many static initializers; they will be concatenated in the order that they are added.- Parameters:
builder- the builder (must not benull)
-
staticMethod
Add a static method to this type.Static methods on interfaces are always
public.- Parameters:
name- the method name (must not benull)builder- the builder for the method (must not benull)- Returns:
- the descriptor of the new method (not
null)
-
staticMethod
default MethodDesc staticMethod(String name, MethodTypeDesc type, Consumer<StaticMethodCreator> builder) Add a static method to this type having the given predefined method type.Static methods on interfaces are always
public.- Parameters:
name- the method name (must not benull)type- the method type (must not benull)builder- the builder for the method (must not benull)- Returns:
- the descriptor of the new method (not
null)
-
staticMethod
Add a static method to this type having the same name and type as the given method.Static methods on interfaces are always
public.- Parameters:
desc- the original method descriptor (must not benull)builder- the builder for the method (must not benull)- Returns:
- the descriptor of the new method (not
null)
-
staticField
Add a static field to this type.Static fields on interfaces are always
publicandfinal.- Parameters:
name- the field name (must not benull)builder- the builder for the field (must not benull)- Returns:
- a variable for the static field (not
null)
-
staticField
Add a static field to this type.- Parameters:
name- the field name (must not benull)initial- the field's initial value (must not benull)- Returns:
- a variable for the static field (not
null)
-
constantField
Add a public static final field to this type. The field is initialized to the givenvalue.- Parameters:
name- the field name (must not benull)value- the constant value (must not benull)- Returns:
- a variable for the static field (not
null)
-
stringListResourceConstant
Create a private constant which loads the given list of strings from a generated resource file. The constant may not be used outside of this class. Any number of strings may be stored in the constant; however, for smaller lists,Const.of(List)is preferred.- Parameters:
name- the constant name (must not benull)items- the list of strings for the constant (must not benull)- Returns:
- the constant (not
null)
-
stringSetResourceConstant
Create a private constant which loads the given set of strings from a generated resource file. The constant may not be used outside of this class. Any number of strings may be stored in the constant; however, for smaller sets,Const.of(Set)is preferred.- Parameters:
name- the constant name (must not benull)items- the set of strings for the constant (must not benull)- Returns:
- the constant (not
null)
-
stringMapResourceConstant
Create a private constant which loads the given map of strings from a generated resource file. The constant may not be used outside of this class. Any number of strings may be stored in the constant; however, for smaller maps,Const.of(Map)is preferred.- Parameters:
name- the constant name (must not benull)items- the map of strings for the constant (must not benull)- Returns:
- the constant (not
null)
-
this_
This this_()Returns thethisexpression. This expression is only valid for instance methods and constructors.- Returns:
- the
thisexpression
-
staticFields
Returns a list of descriptors of all static fields added to this class so far.- Returns:
- a list of descriptors of all static fields added to this class so far
-
instanceFields
Returns a list of descriptors of all instance fields added to this class so far.- Returns:
- a list of descriptors of all instance fields added to this class so far
-
staticMethods
List<MethodDesc> staticMethods()Returns a list of descriptors of all static methods added to this class so far.- Returns:
- a list of descriptors of all static methods added to this class so far
-
instanceMethods
List<MethodDesc> instanceMethods()Returns a list of descriptors of all instance methods added to this class so far.- Returns:
- a list of descriptors of all instance methods added to this class so far
-
constructors
List<ConstructorDesc> constructors()Returns a list of descriptors of all constructors added to this class so far.- Returns:
- a list of descriptors of all constructors added to this class so far
-