All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spoon.reflect.code.CtIf Maven / Gradle / Ivy

/*
 * SPDX-License-Identifier: (MIT OR CECILL-C)
 *
 * Copyright (C) 2006-2019 INRIA and contributors
 *
 * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of 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.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import spoon.template.TemplateParameter;

import static spoon.reflect.path.CtRole.CONDITION;
import static spoon.reflect.path.CtRole.ELSE;
import static spoon.reflect.path.CtRole.THEN;

/**
 * This code element represents an if statement.
 * Example:
 * 
 *     if (1==0) {
 *     	System.out.println("foo");
 *     } else {
 *     	System.out.println("bar");
 *     }
 * 
*/ public interface CtIf extends CtStatement, TemplateParameter { /** * Gets the boolean expression that represents the if's * condition. */ @PropertyGetter(role = CONDITION) CtExpression getCondition(); /** * Gets the statement executed when the condition is false. */ @PropertyGetter(role = ELSE) S getElseStatement(); /** * Gets the statement executed when the condition is true. */ @PropertyGetter(role = THEN) S getThenStatement(); /** * Sets the boolean expression that represents the if's * condition. */ @PropertySetter(role = CONDITION) T setCondition(CtExpression expression); /** * Sets the statement executed when the condition is false. */ @PropertySetter(role = ELSE) T setElseStatement(CtStatement elseStatement); /** * Sets the statement executed when the condition is true. */ @PropertySetter(role = THEN) T setThenStatement(CtStatement thenStatement); @Override CtIf clone(); }