public interface CtYieldStatement extends CtCFlowBreak
yield
statement.
Example:
int x = 0; x = switch ("foo") { default -> { x=x+1; yield x; //<--- yield statement } };A yield statement is implicit in the following example: Example:
int x = 0; x = switch ("foo") { default -> 4; //<--- implicit yield statement };the example wouldn't be allowed without the brackets at the default case, because java syntax defines case -> [expression] or case -> [blockStatement] and yield is not a expression.
Modifier and Type | Method and Description |
---|---|
CtYieldStatement |
clone()
Clone the element which calls this method in a new object.
|
CtExpression<?> |
getExpression()
Gets the expression of the yield statement.
|
<T extends CtYieldStatement> |
setExpression(CtExpression<?> expression)
Gets the expression of the yield statement.
|
comment, getLabel, insertAfter, insertAfter, insertBefore, insertBefore, setLabel
partiallyEvaluate
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
CtExpression<?> getExpression()
<T extends CtYieldStatement> T setExpression(CtExpression<?> expression)
CtYieldStatement 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 CtStatement
Copyright © 2007–2021 Inria. All rights reserved.