001/* 002 * Copyright (c) 2012-2018 Institut National des Sciences Appliquées de Lyon (INSA Lyon) and others 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License 2.0 which is available at 006 * http://www.eclipse.org/legal/epl-2.0. 007 * 008 * SPDX-License-Identifier: EPL-2.0 009 */ 010 011package gololang.ir; 012 013public interface BlockContainer<T> { 014 Block getBlock(); 015 016 017 /** 018 * Defines the contained block. 019 * 020 * <p>This is a builder method. 021 * 022 * @param block an object that can be converted into a {@link Block} 023 * @see Block#of(Object) 024 */ 025 T block(Object block); 026 027 /** 028 * Defines the block as the given statements. 029 * <p>This is a builder method. 030 * @param statements the statements to execute. 031 */ 032 default T body(Object... statements) { 033 return this.block(Block.block(statements)); 034 } 035}