View Javadoc

1   /*
2    * ASDeclarationStatement.java
3    * 
4    * Copyright (c) 2006-2008 David Holroyd
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package uk.co.badgersinfoil.metaas.dom;
20  
21  import java.util.List;
22  
23  // TODO: according to Adobe docs, a decl is a 'directive', not a statement
24  
25  /**
26   * A statement that declares variables, such as
27   * <code>var a = 1;</code>.
28   * 
29   * <p>A declaration-statement may declare multiple variables, each optionally
30   * specifying a type and an initialiser-value.</p>
31   * 
32   * @see StatementContainer#newDeclaration(Expression)
33   */
34  public interface ASDeclarationStatement extends Statement {
35  
36  	/**
37  	 * Returns false if this is a declaration using the <code>var</code>
38  	 * keyword (the default), and true is this is a declaration using the
39  	 * <code>const</code> keyword.
40  	 */
41  	public boolean isConstant();
42  
43  	/**
44  	 * If given true, this declaration will use the <code>const</code>
45  	 * keyword, if given false, this declaration will use the
46  	 * <code>var</code> keyword.
47  	 */
48  	public void setConstant(boolean constant);
49  
50  	/**
51  	 * Returns a list of {@link ASVarDeclarationFragment} objects.
52  	 */
53  	public List getVars();
54  
55  	public String getFirstVarName();
56  
57  	public String getFirstVarTypeName();
58  
59  	public Expression getFirstVarInitializer();
60  }