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

net.sourceforge.jenesis4java.Block Maven / Gradle / Ivy

Go to download

Generating Java sources from strings or patterns can become very inconvenient, in those cases Jenesis 4 Java can be a solution for you. Jenesis 4 Java is a DOM (domain object model) of the Java programming language. The complete java class including annotations and comments is constructed with as a DOM (that can be manipulated in as many passes you need) until you let it encode to a java file.

The newest version!
package net.sourceforge.jenesis4java;

/*
 * #%L
 * Jenesis 4 Java Code Generator
 * %%
 * Copyright (C) 2000 - 2015 jenesis4java
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import java.util.Comparator;
import java.util.List;

/**
 * Copyright (C) 2008, 2010 Richard van Nieuwenhoven - ritchie [at] gmx [dot] at
 * Copyright (C) 2000, 2001 Paul Cody Johnston - [email protected] 
* This file is part of Jenesis4java. Jenesis4java is free software: you can * redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version.
* Jenesis4java is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details.
* You should have received a copy of the GNU Lesser General Public License * along with Jenesis4java. If not, see . */ /** * The {@code Block} superinterface. A {@code Block} is a structure that holds * Statements and typically delimited by braces. {@code Block} acts as a factory * for all {@code Statement} objects. */ public interface Block extends Codeable { /** * Gets the list of statements as an list of {@code Statement}. */ List getStatements(); /** * Insert the expression at the specified index. * * @return the newly created {@link Statement} */ Statement insertStatement(int index, Expression expression); /** * Insert the statement at the specified index. */ void insertStatement(int index, Statement statement); /** * Adds a new {@code Break} statement to this block and returns it. */ Break newBreak(); /** * Adds a new {@code Continue} statement to this block and returns it. */ Continue newContinue(); /** * Adds a new {@code Let} statement to declaration section of this block for * the given type and returns it. */ Let newDeclarationLet(Type type); /** * Adds a new {@code DoWhile} statement to this block and returns it. */ DoWhile newDoWhile(Expression predicate); /** * Adds a new {@code Empty} statement to this block and returns it. */ Empty newEmpty(); /** * Adds a new {@code For} statement to this block and returns it. */ For newFor(); /** * Adds a new {@code If} statement to this block and returns it. */ If newIf(Expression predicate); /** * Adds a new {@code Let} statement to this block for the given type and * returns it. */ Let newLet(Type type); /** * Adds a new {@code LocalBlock} statement to this block and returns it. */ LocalBlock newLocalBlock(); /** * Adds a new {@code LocalClass} statement to this block and returns it. */ LocalClass newLocalClass(String name); /** * Adds a new {@code LocalClass} statement to this block and returns it. */ LocalClass newLocalClass(String name, Comparator comparator); /** * Adds a new {@code Return} statement to this block and returns it. */ Return newReturn(); /** * Adds a new {@code ExpressionStatement} statement to this block on the * given statement {@code Expression} and returns it. */ ExpressionStatement newStmt(Expression expr); /** * Adds a new {@code Switch} statement to this block and returns it. */ Switch newSwitch(Expression integer); /** * Adds a new {@code Synchronized} statement to this block and returns it. */ Synchronized newSynchronized(Expression mutex); /** * Adds a new {@code Throw} statement to this block and returns it. */ Throw newThrow(Expression throwable); /** * Adds a new {@code Try} statement to this block and returns it. */ Try newTry(); /** * Adds a new {@code While} statement to this block and returns it. */ While newWhile(Expression predicate); /** * removes a statement from the statement list. */ void removeStmt(Statement statement); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy