NewClassTree.java revision 3193:3b3bea483542
1247580Smm/*
2247580Smm * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
3247580Smm * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4247580Smm *
5247580Smm * This code is free software; you can redistribute it and/or modify it
6247580Smm * under the terms of the GNU General Public License version 2 only, as
7247580Smm * published by the Free Software Foundation.  Oracle designates this
8247580Smm * particular file as subject to the "Classpath" exception as provided
9247580Smm * by Oracle in the LICENSE file that accompanied this code.
10247580Smm *
11247580Smm * This code is distributed in the hope that it will be useful, but WITHOUT
12247580Smm * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13247580Smm * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14247580Smm * version 2 for more details (a copy is included in the LICENSE file that
15247580Smm * accompanied this code).
16247580Smm *
17247580Smm * You should have received a copy of the GNU General Public License version
18247580Smm * 2 along with this work; if not, write to the Free Software Foundation,
19247580Smm * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20247580Smm *
21247580Smm * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22247580Smm * or visit www.oracle.com if you need additional information or have any
23288572Smav * questions.
24251646Sdelphij */
25265744Sdelphij
26297112Smavpackage com.sun.source.tree;
27247580Smm
28247580Smmimport java.util.List;
29247580Smm
30247580Smm/**
31247580Smm * A tree node to declare a new instance of a class.
32247580Smm *
33247580Smm * For example:
34247580Smm * <pre>
35247580Smm *   new <em>identifier</em> ( )
36247580Smm *
37247580Smm *   new <em>identifier</em> ( <em>arguments</em> )
38247580Smm *
39247580Smm *   new <em>typeArguments</em> <em>identifier</em> ( <em>arguments</em> )
40247580Smm *       <em>classBody</em>
41247580Smm *
42247580Smm *   <em>enclosingExpression</em>.new <em>identifier</em> ( <em>arguments</em> )
43263390Sdelphij * </pre>
44247580Smm *
45247580Smm * @jls section 15.9
46247580Smm *
47247580Smm * @author Peter von der Ah&eacute;
48247580Smm * @author Jonathan Gibbons
49247580Smm * @since 1.6
50247580Smm */
51247580Smmpublic interface NewClassTree extends ExpressionTree {
52253820Sdelphij    /**
53247580Smm     * Returns the enclosing expression, or {@code null} if none.
54247580Smm     * @return the enclosing expression
55288549Smav     */
56249195Smm    ExpressionTree getEnclosingExpression();
57247580Smm
58247580Smm    /**
59249195Smm     * Returns the type arguments for the object being created.
60247580Smm     * @return the type arguments
61247580Smm     */
62247580Smm    List<? extends Tree> getTypeArguments();
63247580Smm
64247580Smm    /**
65247580Smm     * Returns the name of the class being instantiated.
66247580Smm     * @return the name
67247580Smm     */
68249195Smm    ExpressionTree getIdentifier();
69247580Smm
70247580Smm    /**
71247580Smm     * Returns the arguments for the constructor to be invoked.
72247580Smm     * @return the arguments
73247580Smm     */
74247580Smm    List<? extends ExpressionTree> getArguments();
75247580Smm
76247580Smm    /**
77249195Smm     * Returns the class body if an anonymous class is being
78247580Smm     * instantiated, and {@code null} otherwise.
79247580Smm     * @return the class body
80247580Smm     */
81247580Smm    ClassTree getClassBody();
82277585Sdelphij}
83249195Smm