Example usage for org.eclipse.jdt.core.dom AST newEnhancedForStatement

List of usage examples for org.eclipse.jdt.core.dom AST newEnhancedForStatement

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom AST newEnhancedForStatement.

Prototype

public EnhancedForStatement newEnhancedForStatement() 

Source Link

Document

Creates a new unparented enhanced for statement node owned by this AST.

Usage

From source file:org.jboss.forge.roaster.model.impl.statements.ForEachStatementImpl.java

License:Open Source License

@Override
public EnhancedForStatement materialize(AST ast) {
    if (iter != null) {
        return iter;
    }// w ww.jav a  2 s .co m
    iter = ast.newEnhancedForStatement();

    iter.getParameter().setName(iter.getAST().newSimpleName(name));
    iter.getParameter().setType(JDTHelper.getType(type, iter.getAST()));

    if (source != null) {
        iter.setExpression(wireAndGetExpression(source, this, ast));
    }
    if (body != null) {
        iter.setBody(wireAndGetStatement(body, this, ast));
    }
    return iter;
}