public class Property extends ModifierSupport implements Renderable, Commentable, Annotatable
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZEDAT, CB, CC, CLP, COLN, COMA, CP, DOT, DQ, EMPTY, EQ, EXTENDS, GT, IMPLEMENTS, INDENT, JAVA_LANG, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_STRING, LT, NEWLINE, NEWLINE_PATTERN, OB, OC, OP, Q, SEMICOLN, SEMICOLN_SUFFIX_PATTERN, SPACE, STAR, THROWS, VARARGALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INIT| Constructor and Description |
|---|
Property(List<AnnotationRef> annotations,
TypeRef typeRef,
String name,
List<String> comments,
boolean enumConstant,
boolean synthetic,
Modifiers modifiers,
Map<AttributeKey,Object> attributes)
Deprecated.
|
Property(List<AnnotationRef> annotations,
TypeRef typeRef,
String name,
List<String> comments,
Modifiers modifiers,
Map<AttributeKey,Object> attributes)
Deprecated.
|
Property(Modifiers modifiers,
Map<AttributeKey,Object> attributes,
List<String> comments,
List<AnnotationRef> annotations,
TypeRef typeRef,
String name,
Optional<Expression> initialValue,
boolean enumConstant,
boolean synthetic) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
List<AnnotationRef> |
getAnnotations() |
List<String> |
getComments()
Get the list of comments.
|
protected String |
getDefaultValue()
Deprecated.
|
Optional<Expression> |
getInitialValue() |
String |
getName() |
String |
getNameCapitalized() |
Set<ClassRef> |
getReferences() |
TypeRef |
getTypeRef() |
int |
hashCode() |
boolean |
isEnumConstant() |
boolean |
isSynthetic() |
static Property |
newProperty(Class type,
String name) |
static Property |
newProperty(String name) |
static Property |
newProperty(TypeRef typeRef,
String name) |
String |
render()
Render the type into a
String for the purpose of code generation. |
PropertyRef |
toReference() |
String |
toString() |
Property |
withErasure()
Get the property after the type erasure is applied.
|
Property |
withInitialValue(Expression initialValue)
Get the property with the specified object as iniital value.
|
Property |
withInitialValue(Object initialValue)
Get the property with the specified object as iniital value.
|
Property |
withInitialValue(Optional<Expression> initialValue)
Get the property with the specified initial value
|
Property |
withoutInitialValue()
Get the property without its initial value.
|
protected Property |
withoutModiers()
This is only used for rendering method arguments, where we usually string modifiers.
|
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiersgetAttribute, getAttributes, hasAttributeclone, finalize, getClass, notify, notifyAll, wait, wait, waitnoSemicolon, tabrenderCommentsrenderAnnotationspublic Property(Modifiers modifiers, Map<AttributeKey,Object> attributes, List<String> comments, List<AnnotationRef> annotations, TypeRef typeRef, String name, Optional<Expression> initialValue, boolean enumConstant, boolean synthetic)
@Deprecated public Property(List<AnnotationRef> annotations, TypeRef typeRef, String name, List<String> comments, boolean enumConstant, boolean synthetic, Modifiers modifiers, Map<AttributeKey,Object> attributes)
@Deprecated public Property(List<AnnotationRef> annotations, TypeRef typeRef, String name, List<String> comments, Modifiers modifiers, Map<AttributeKey,Object> attributes)
public List<AnnotationRef> getAnnotations()
getAnnotations in interface Annotatablepublic TypeRef getTypeRef()
public String getName()
public List<String> getComments()
CommentablegetComments in interface CommentableList of comments.public boolean isEnumConstant()
public boolean isSynthetic()
public Optional<Expression> getInitialValue()
public String getNameCapitalized()
protected Property withoutModiers()
public Property withErasure()
public Property withoutInitialValue()
public Property withInitialValue(Object initialValue)
initialValue - an Objectpublic Property withInitialValue(Expression initialValue)
initialValue - an Expressionpublic Property withInitialValue(Optional<Expression> initialValue)
initialValue - an Optional Expression@Deprecated protected String getDefaultValue()
getInitialValue() instead.public PropertyRef toReference()
public String render()
RenderableString for the purpose of code generation.
This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should
be idempotent.
Regarding idempotency this method may yield different result based on the context it is used even if the internal state of
the object does not change.
An example of such case, is a reference to class that may change based on the package from which it's refenced.render in interface RenderableString representation of the object as it's meant to appear in the generated code.Copyright © 2023. All rights reserved.