Package io.sundr.model
Class Property
java.lang.Object
io.sundr.model.AttributeSupport
io.sundr.model.ModifierSupport
io.sundr.model.Property
- All Implemented Interfaces:
Annotatable,Attributeable,Commentable,Node,Renderable
-
Field Summary
Fields inherited from class io.sundr.model.ModifierSupport
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZEDFields inherited from interface io.sundr.model.Attributeable
ALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INITFields inherited from interface io.sundr.model.Node
AT, 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, VARARG -
Constructor Summary
ConstructorsConstructorDescriptionProperty(Modifiers modifiers, Map<AttributeKey, Object> attributes, List<String> comments, List<AnnotationRef> annotations, TypeRef typeRef, String name, Optional<Expression> initialValue, boolean enumConstant, boolean synthetic) 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. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the list of comments.protected StringDeprecated.getName()inthashCode()booleanbooleanstatic PropertynewProperty(TypeRef typeRef, String name) static PropertynewProperty(Class type, String name) static PropertynewProperty(String name) render()Render the type into aStringfor the purpose of code generation.toString()Get the property after the type erasure is applied.withInitialValue(Expression initialValue) Get the property with the specified object as iniital value.withInitialValue(Object initialValue) Get the property with the specified object as iniital value.withInitialValue(Optional<Expression> initialValue) Get the property with the specified initial valueGet the property without its initial value.protected PropertyThis is only used for rendering method arguments, where we usually string modifiers.Methods inherited from class io.sundr.model.ModifierSupport
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiersMethods inherited from class io.sundr.model.AttributeSupport
getAttribute, getAttributes, hasAttributeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.sundr.model.Annotatable
renderAnnotationsMethods inherited from interface io.sundr.model.Commentable
renderCommentsMethods inherited from interface io.sundr.model.Renderable
tab
-
Constructor Details
-
Property
public Property(Modifiers modifiers, Map<AttributeKey, Object> attributes, List<String> comments, List<AnnotationRef> annotations, TypeRef typeRef, String name, Optional<Expression> initialValue, boolean enumConstant, boolean synthetic) -
Property
@Deprecated public Property(List<AnnotationRef> annotations, TypeRef typeRef, String name, List<String> comments, boolean enumConstant, boolean synthetic, Modifiers modifiers, Map<AttributeKey, Object> attributes) Deprecated. -
Property
@Deprecated public Property(List<AnnotationRef> annotations, TypeRef typeRef, String name, List<String> comments, Modifiers modifiers, Map<AttributeKey, Object> attributes) Deprecated.
-
-
Method Details
-
newProperty
-
newProperty
-
newProperty
-
getAnnotations
- Specified by:
getAnnotationsin interfaceAnnotatable
-
getTypeRef
-
getName
-
getComments
Description copied from interface:CommentableGet the list of comments.- Specified by:
getCommentsin interfaceCommentable- Returns:
- a
Listof comments.
-
isEnumConstant
public boolean isEnumConstant() -
isSynthetic
public boolean isSynthetic() -
getInitialValue
-
getNameCapitalized
-
getReferences
-
withoutModiers
This is only used for rendering method arguments, where we usually string modifiers.- Returns:
- the property without any modifiers
-
withErasure
Get the property after the type erasure is applied. This in essense means that the type parameters are replaced by Object.- Returns:
- the 'erased` property.
-
withoutInitialValue
Get the property without its initial value.- Returns:
- the property.
-
withInitialValue
Get the property with the specified object as iniital value.- Parameters:
initialValue- anObject- Returns:
- the property.
-
withInitialValue
Get the property with the specified object as iniital value.- Parameters:
initialValue- anExpression- Returns:
- the property.
-
withInitialValue
Get the property with the specified initial value- Parameters:
initialValue- anOptionalExpression- Returns:
- the property.
-
getDefaultValue
Deprecated.Get the default value of the property The mehotd is deprecated, usegetInitialValue()instead.- Returns:
- String the default value of the Property
-
toReference
-
equals
-
hashCode
public int hashCode() -
render
Description copied from interface:RenderableRender the type into aStringfor 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.- Specified by:
renderin interfaceRenderable- Returns:
- the
Stringrepresentation of the object as it's meant to appear in the generated code.
-
toString
-