Interface FieldMaker
-
Method Summary
Modifier and TypeMethodDescriptionenum_()
Indicate that this field is an enum constant.final_()
Switch this field to be final.Set an initial constant value for this field.Set an exact initial constant value for this field, supported only when the class is built dynamically instead of loaded from a file.name()
Returns the name of this field.private_()
Switch this field to be private.Switch this field to be protected.public_()
Switch this field to be public.Define a signature for this member, which is a string for supporting generic types.static_()
Switch this field to be static.Indicate that this field is synthetic.Switch this field to be transient.type()
Returns the type of this field being made.Switch this field to be volatile.Methods inherited from interface org.cojen.maker.Maker
addAnnotation, addAttribute, classMaker
-
Method Details
-
type
Type type()Returns the type of this field being made. -
name
-
public_
FieldMaker public_()Switch this field to be public. Fields are package-private by default. -
private_
FieldMaker private_()Switch this field to be private. Fields are package-private by default. -
protected_
FieldMaker protected_()Switch this field to be protected. Fields are package-private by default.- Specified by:
protected_
in interfaceMaker
- Returns:
- this
-
static_
FieldMaker static_()Switch this field to be static. Fields are non-static by default. -
final_
FieldMaker final_()Switch this field to be final. Fields are non-final by default. -
volatile_
FieldMaker volatile_()Switch this field to be volatile. Fields are non-volatile by default.- Returns:
- this
-
transient_
FieldMaker transient_()Switch this field to be transient. Fields are non-transient by default.- Returns:
- this
-
synthetic
FieldMaker synthetic()Indicate that this field is synthetic. Fields are non-synthetic by default. -
enum_
FieldMaker enum_()Indicate that this field is an enum constant. No checks or modifications are performed to ensure that the enum field is defined correctly.- Returns:
- this
-
signature
Define a signature for this member, which is a string for supporting generic types. The components can be strings or types (class, ClassMaker, etc.), which are concatenated into a single string. Consult the JVM specification for the signature syntax. -
init
Set an initial constant value for this field. The allowed constants are the same as those allowed by theVariable.set
method. Complex constants can be assigned usinginitExact
or astatic initializer
.- Returns:
- this
- Throws:
IllegalArgumentException
- if the value isn't a supported constantIllegalStateException
- if not a static field, or if the value type isn't compatible with the field type
-
initExact
Set an exact initial constant value for this field, supported only when the class is built dynamically instead of loaded from a file. At runtime, the object instance provided here is exactly the same as referenced by the generated class. For simple constants, the regular init method is preferred.- Returns:
- this
- Throws:
IllegalStateException
- if not a static field, or if the value isn't compatible with the field type, or if the class being made isexternal
- See Also:
-