Class BoxStructLiteral
java.lang.Object
ortus.boxlang.compiler.ast.BoxNode
ortus.boxlang.compiler.ast.BoxExpression
ortus.boxlang.compiler.ast.expression.BoxStructLiteral
- All Implemented Interfaces:
IBoxLiteral,BoxVisitable
A struct literal comes in two forms, ordered and unordered (default).
The unordered struct uses curly braces `{}` like a JSON object.
The ordered struct, uses square brackets `[]` like an array literal.
The difference is structs use a comma-delimited list of key/value pairs.
Note, key/value pairs ANYWHERE in Boxlang can either be specified as `
foo=bar` OR `foo : bar`. This goes for strut literals, function parameters,
or class/UDF metadata.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBoxStructLiteral(BoxStructType type, List<BoxExpression> values, Position position, String sourceText) Creates the AST node for Struct Literals -
Method Summary
Modifier and TypeMethodDescriptionAccept method for replacing visitor support.voidAccept method for visitor support.Returns a human-readable description of the node, which it manufactures from the class name.getType()booleanUtility method to detect if an expression node is a terminal LiteralvoidsetType(BoxStructType type) voidsetValues(List<BoxExpression> values) toMap()Methods inherited from class ortus.boxlang.compiler.ast.BoxExpression
getAsLiteralValue, getAsSimpleValue, getAsSimpleValueMethods inherited from class ortus.boxlang.compiler.ast.BoxNode
addComment, associateComments, endsOnSameLineAs, enumToMap, getAncestors, getChildren, getComments, getDescendants, getDescendantsOfType, getDescendantsOfType, getDocComment, getFirstAncestorOfType, getFirstAncestorOfType, getFirstNodeOfType, getFirstNodeOfType, getFirstNodeOfTypes, getParent, getPosition, getSourceText, isAfter, isBefore, isInside, replaceChildren, replaceChildren, setComments, setParent, setPosition, setSourceText, startsOnEndLineOf, toJSON, toString
-
Constructor Details
-
BoxStructLiteral
public BoxStructLiteral(BoxStructType type, List<BoxExpression> values, Position position, String sourceText) Creates the AST node for Struct Literals- Parameters:
values- initialization valuesposition- position of the statement in the source codesourceText- source code that originated the Node
-
-
Method Details
-
getValues
-
getType
-
isLiteral
public boolean isLiteral()Description copied from class:BoxExpressionUtility method to detect if an expression node is a terminal Literal- Overrides:
isLiteralin classBoxExpression- Returns:
- true if it is false otherwise
-
setValues
-
setType
-
toMap
-
accept
Description copied from interface:BoxVisitableAccept method for visitor support.- Specified by:
acceptin interfaceBoxVisitable- Parameters:
v- the visitor implementation
-
accept
Description copied from interface:BoxVisitableAccept method for replacing visitor support. Each accept returns the node, or a replacement node.- Specified by:
acceptin interfaceBoxVisitable- Parameters:
v- the visitor implementation
-
getDescription
Description copied from class:BoxNodeReturns a human-readable description of the node, which it manufactures from the class name.While that is quite often good enough, override this method in subclasses to provide a better description when this default does not work quite right.
- Overrides:
getDescriptionin classBoxNode- Returns:
- human readable description of the expression, for use in error messages etc
-