spoon.reflect.code.CtStatement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spoon-core Show documentation
Show all versions of spoon-core Show documentation
Spoon is a tool for meta-programming, analysis and transformation of Java programs.
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
package spoon.reflect.code;
import spoon.reflect.declaration.ParentNotInitializedException;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import static spoon.reflect.path.CtRole.LABEL;
/**
* This abstract code element represents all the statements, which can be part
* of a block.
*
* @see spoon.reflect.code.CtBlock
*/
public interface CtStatement extends CtCodeElement {
/**
* Inserts a statement after the current statement.
*/
T insertAfter(CtStatement statement) throws ParentNotInitializedException;
/**
* Inserts a statement list before the current statement.
*/
T insertAfter(CtStatementList statements) throws ParentNotInitializedException;
/**
* Inserts a statement given as parameter before the current statement
* (this).
*/
T insertBefore(CtStatement statement) throws ParentNotInitializedException;
/**
* Inserts a statement list before the current statement.
*/
T insertBefore(CtStatementList statements) throws ParentNotInitializedException;
/**
* Gets the label of this statement if defined.
*
* @return the label's name (null if undefined)
*/
@PropertyGetter(role = LABEL)
String getLabel();
/**
* Sets the label of this statement.
*/
@PropertySetter(role = LABEL)
T setLabel(String label);
/**
* Comments the statement (eg `// call()`). Implemented as a replacement of the statement with a CtComment having the statement as text.
*/
void comment();
@Override
CtStatement clone();
}