T
- type of the variablepublic interface CtLocalVariable<T> extends CtStatement, CtVariable<T>, CtRHSReceiver<T>
// defines a local variable x int x = 0;With Java 10, the local variable inference is now authorized, then the following code is valid too in a block scope:
// local variable in Java 10 var x = 0;
CtExecutable
Modifier and Type | Method and Description |
---|---|
CtLocalVariable<T> |
clone()
Clone the element which calls this method in a new object.
|
CtExpression<T> |
getAssignment()
Useful proxy to
CtVariable.getDefaultExpression() . |
CtLocalVariableReference<T> |
getReference()
Returns the corresponding reference.
|
boolean |
isInferred()
Return true if this variable's type is not explicitely defined in the source code, but was using the `var` keyword of Java 10.
|
<U extends CtRHSReceiver<T>> |
setAssignment(CtExpression<T> assignment)
Sets the right-hand side expression (RHS) of the "=" operator.
|
<U extends CtLocalVariable<T>> |
setInferred(boolean inferred)
Set true if the variable must be inferred.
|
comment, getLabel, insertAfter, insertAfter, insertBefore, insertBefore, setLabel
partiallyEvaluate
getDefaultExpression, isPartOfJointDeclaration, setDefaultExpression
getSimpleName, setSimpleName
getType, setType
addModifier, getExtendedModifiers, getModifiers, getVisibility, hasModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, removeModifier, setExtendedModifiers, setModifiers, setVisibility
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelow
getFactory, setFactory
accept
filterChildren, map, map
CtLocalVariableReference<T> getReference()
CtNamedElement
getReference
in interface CtNamedElement
getReference
in interface CtVariable<T>
CtExpression<T> getAssignment()
CtVariable.getDefaultExpression()
.getAssignment
in interface CtRHSReceiver<T>
CtLocalVariable<T> clone()
CtElement
Refactoring.copyType(CtType)
and Refactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.clone
in interface CtCodeElement
clone
in interface CtElement
clone
in interface CtNamedElement
clone
in interface CtStatement
<U extends CtRHSReceiver<T>> U setAssignment(CtExpression<T> assignment)
CtRHSReceiver
setAssignment
in interface CtRHSReceiver<T>
boolean isInferred()
<U extends CtLocalVariable<T>> U setInferred(boolean inferred)
Copyright © 2007–2021 Inria. All rights reserved.