Class JavaExpression
java.lang.Object
com.regnosys.rosetta.generator.java.statement.builder.JavaStatementBuilder
com.regnosys.rosetta.generator.java.statement.builder.JavaExpression
- All Implemented Interfaces:
JavaLambdaBody,TargetLanguageRepresentation
- Direct Known Subclasses:
JavaThis,JavaVariable
An arbitrary Java expression.
See `JavaStatementBuilder` for more documentation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JavaExpressionAn expression representing the value `null`. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIf this statement builder ends with multiple branches, assign all expressions to a new variable and return a new builder ending with that variable.complete(Function<JavaExpression, JavaStatement> completer) Complete this statement builder by mapping all expressions to a statement.completeAsAssignment(GeneratedIdentifier variableId) Complete this statement builder by assigning all expressions to a given variable.Complete this statement builder by ending all expressions with a semicolon.Complete this statement builder by returning all expressions.declareAsVariable(boolean isFinal, String variableId, JavaScope scope) Assign all expressions to a new variable, and return a new builder ending with that variable.static JavaExpressionGet the type of the last expression of this builder, or the least common supertype of all expressions in different branches of this builder.mapExpression(Function<JavaExpression, ? extends JavaStatementBuilder> mapper) Map all expressions contained in this builder to a new builder, and append the result.then(JavaExpression after, BiFunction<JavaExpression, JavaExpression, JavaStatementBuilder> combineExpressions, JavaScope scope) then(JavaStatementBuilder after, BiFunction<JavaExpression, JavaExpression, JavaStatementBuilder> combineExpressions, JavaScope scope) Append another statement builder to this one, and combine this expression with the other using the given operation.Convert this statement builder into a valid lambda body.Methods inherited from class com.regnosys.rosetta.generator.java.statement.builder.JavaStatementBuilder
mapExpressionIfNotNullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.regnosys.rosetta.generator.TargetLanguageRepresentation
appendTo
-
Field Details
-
NULL
An expression representing the value `null`.
-
-
Constructor Details
-
JavaExpression
-
-
Method Details
-
from
public static JavaExpression from(org.eclipse.xtend2.lib.StringConcatenationClient value, JavaType type) -
getExpressionType
Description copied from class:JavaStatementBuilderGet the type of the last expression of this builder, or the least common supertype of all expressions in different branches of this builder.- Specified by:
getExpressionTypein classJavaStatementBuilder
-
mapExpression
public JavaStatementBuilder mapExpression(Function<JavaExpression, ? extends JavaStatementBuilder> mapper) Description copied from class:JavaStatementBuilderMap all expressions contained in this builder to a new builder, and append the result. This will flatten Java block statements.- Specified by:
mapExpressionin classJavaStatementBuilder
-
then
public JavaStatementBuilder then(JavaStatementBuilder after, BiFunction<JavaExpression, JavaExpression, JavaStatementBuilder> combineExpressions, JavaScope scope) Description copied from class:JavaStatementBuilderAppend another statement builder to this one, and combine this expression with the other using the given operation.- Specified by:
thenin classJavaStatementBuilder
-
then
public JavaStatementBuilder then(JavaExpression after, BiFunction<JavaExpression, JavaExpression, JavaStatementBuilder> combineExpressions, JavaScope scope) -
complete
Description copied from class:JavaStatementBuilderComplete this statement builder by mapping all expressions to a statement.- Specified by:
completein classJavaStatementBuilder
-
completeAsReturn
Description copied from class:JavaStatementBuilderComplete this statement builder by returning all expressions.- Specified by:
completeAsReturnin classJavaStatementBuilder
-
completeAsExpressionStatement
Description copied from class:JavaStatementBuilderComplete this statement builder by ending all expressions with a semicolon.- Specified by:
completeAsExpressionStatementin classJavaStatementBuilder
-
completeAsAssignment
Description copied from class:JavaStatementBuilderComplete this statement builder by assigning all expressions to a given variable.- Specified by:
completeAsAssignmentin classJavaStatementBuilder
-
declareAsVariable
Description copied from class:JavaStatementBuilderAssign all expressions to a new variable, and return a new builder ending with that variable.- Specified by:
declareAsVariablein classJavaStatementBuilder
-
collapseToSingleExpression
Description copied from class:JavaStatementBuilderIf this statement builder ends with multiple branches, assign all expressions to a new variable and return a new builder ending with that variable. If this statement builder does not end in multiple branches, return itself unmodified.- Specified by:
collapseToSingleExpressionin classJavaStatementBuilder
-
toLambdaBody
Description copied from class:JavaStatementBuilderConvert this statement builder into a valid lambda body.- Specified by:
toLambdaBodyin classJavaStatementBuilder
-