Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Constructor and description |
---|
DeclarationExpression
(VariableExpression left, Token operation, Expression right) Creates a DeclarationExpression for VariableExpressions like "def x" or "String y = 'foo'". |
DeclarationExpression
(Expression left, Token operation, Expression right) Creates a DeclarationExpression for Expressions like "def (x, y) = [1, 2]" |
Type | Name and description |
---|---|
TupleExpression |
getTupleExpression() This method returns the left hand side of the declaration cast to the TupleExpression type. |
VariableExpression |
getVariableExpression() This method returns the left hand side of the declaration cast to the VariableExpression type. |
boolean |
isMultipleAssignmentDeclaration() This method tells you if this declaration is a multiple assignment declaration, which has the form "def (x, y) = ..." in Groovy. |
void |
setLeftExpression(Expression leftExpression) This method sets the leftExpression for this BinaryExpression. |
void |
setRightExpression(Expression rightExpression) |
Expression |
transformExpression(ExpressionTransformer transformer) |
void |
visit(GroovyCodeVisitor visitor) |
Creates a DeclarationExpression for VariableExpressions like "def x" or "String y = 'foo'".
left
- the left hand side of a variable declarationoperation
- the operation, typically an assignment operatorright
- the right hand side of a declarationCreates a DeclarationExpression for Expressions like "def (x, y) = [1, 2]"
left
- the left hand side of a declaration. Must be either a VariableExpression or
a TupleExpression with at least one element.operation
- the operation, typically an assignment operatorright
- the right hand side of a declarationThis method returns the left hand side of the declaration cast to the TupleExpression type. This is an unsafe method to call. In a single assignment statement, the left hand side will be a VariableExpression and a ClassCastException will occur. If you invoke this method then be sure to invoke isMultipleAssignmentDeclaration() first to check that it is safe to do so. If that method returns true then this method is safe to call.
This method returns the left hand side of the declaration cast to the VariableExpression type. This is an unsafe method to call. In a multiple assignment statement, the left hand side will be a TupleExpression and a ClassCastException will occur. If you invoke this method then be sure to invoke isMultipleAssignmentDeclaration() first to check that it is safe to do so. If that method returns true then this method is safe to call.
This method tells you if this declaration is a multiple assignment declaration, which has the form "def (x, y) = ..." in Groovy. If this method returns true, then the left hand side is an ArgumentListExpression. Do not call "getVariableExpression()" on this object if this method returns true, instead use "getLeftExpression()".
This method sets the leftExpression for this BinaryExpression. The parameter must be either a VariableExpression or a TupleExpression with one or more elements.
leftExpression
- either a VariableExpression or a TupleExpression with one or more elements.Copyright © 2003-2015 The Apache Software Foundation. All rights reserved.