Package asteroid.nodes
Class PropertyNodeBuilder
- java.lang.Object
-
- asteroid.nodes.PropertyNodeBuilder
-
public final class PropertyNodeBuilder extends Object
Creates a newPropertyNodeinstance- Since:
- 0.1.4
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyNodebuild()Returns the initializedPropertyNodePropertyNodeBuilderinitialValueExpression(Expression initValueExpr)Sets an initial value for the property.PropertyNodeBuildermodifiers(int modifiers)Sets property modifiers: static/public/...PropertyNodeBuilderowner(ClassNode owner)Sets the property ownerstatic PropertyNodeBuilderproperty(String propertyName)Creates a builder from the property namePropertyNodeBuildertype(Class type)Sets the type of the property
AST
-
-
-
Method Detail
-
property
public static PropertyNodeBuilder property(String propertyName)
Creates a builder from the property name- Parameters:
propertyName- the name of the property- Returns:
- an instance of
PropertyNodeBuilder - Since:
- 0.1.4
-
modifiers
public PropertyNodeBuilder modifiers(int modifiers)
Sets property modifiers: static/public/...
AST
Resultproperty('solution') .modifiers(A.ACC.ACC_PUBLIC) .build()public Object solution- Parameters:
modifiers- useA.ACCto set property modifiers- Returns:
- current instance of
PropertyNodeBuilder - Since:
- 0.1.4
-
type
public PropertyNodeBuilder type(Class type)
Sets the type of the property
AST
Resultproperty('solution') .modifiers(A.ACC.ACC_PUBLIC) .type(String) .build()public String solution- Parameters:
type- theClassof the property- Returns:
- current instance of
PropertyNodeBuilder - Since:
- 0.1.4
-
owner
public PropertyNodeBuilder owner(ClassNode owner)
Sets the property owner- Parameters:
owner- to which class node this property belongs- Returns:
- current instance of
PropertyNodeBuilder - Since:
- 0.1.4
-
initialValueExpression
public PropertyNodeBuilder initialValueExpression(Expression initValueExpr)
Sets an initial value for the property. AST
Resultproperty('solution') .modifiers(A.ACC.ACC_PUBLIC) .type(String) .initialValue(A.EXPR.constX('42')) .build()public String solution = "42"- Parameters:
initValueExpr- the initial value of the property- Returns:
- current instance of
PropertyNodeBuilder - Since:
- 0.1.4
-
build
public PropertyNode build()
Returns the initializedPropertyNode- Returns:
- the
PropertyNodeinstance built by this builder - Since:
- 0.1.4
-
-