Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ThrowStatement


     *
     * @param type exception type
     * @param text
     */
    public void addThrowException(String type, String text) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(stringLiteral(text));
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
View Full Code Here


     *
     * @param type exception type
     * @param expr initializer expression
     */
    public void addThrowException(String type, ExpressionBuilderBase expr) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(expr.getExpression());
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
View Full Code Here

    SimpleType exType = ast.newSimpleType(exName);
    ClassInstanceCreation newExType = ast.newClassInstanceCreation();
    newExType.setType(exType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newExType);
    block.statements().add(statement);
  }
View Full Code Here

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);

    return input;
  }
View Full Code Here

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);

    return input;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ThrowStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.