1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core.jdom;
14 * Represents a field declaration. The corresponding
15 * syntactic units are FieldDeclaration (JLS2 8.3) and ConstantDeclaration
16 * (JLS2 9.3) restricted to a single VariableDeclarator clause.
17 * A field has no children. The parent of a field is a type.
19 * This interface is not intended to be implemented by clients.
22 public interface IDOMField extends IDOMMember {
24 * Returns the initializer expression for this field.
25 * The syntax for an initializer corresponds to VariableInitializer (JLS2 8.3).
27 * Note: The expression does not include a "<code>=</code>".
30 * @return the initializer expression, or <code>null</code> if this field does
31 * not have an initializer
33 public String getInitializer();
35 * The <code>IDOMField</code> refinement of this <code>IDOMNode</code>
36 * method returns the name of this field. The syntax for the name of a field
37 * corresponds to VariableDeclaratorId (JLS2 8.3).
39 public String getName();
41 * Returns the type name of this field. The syntax for a type name of a field
42 * corresponds to Type in Field Declaration (JLS2 8.3).
44 * @return the type name
46 public String getType();
48 * Sets the initializer expression for this field.
49 * The syntax for an initializer corresponds to VariableInitializer (JLS2 8.3).
51 * Note: The expression does not include a "<code>=</code>".
54 * @param initializer the initializer expression, or <code>null</code> indicating
55 * the field does not have an initializer
57 public void setInitializer(String initializer);
59 * The <code>IDOMField</code> refinement of this <code>IDOMNode</code>
60 * method sets the name of this field. The syntax for the name of a field
61 * corresponds to VariableDeclaratorId (JLS2 8.3).
63 * @exception IllegalArgumentException if <code>null</code> is specified
65 public void setName(String name) throws IllegalArgumentException;
67 * Sets the type name of this field. The syntax for a type name of a field
68 * corresponds to Type in Field Declaration (JLS2 8.3). Type names must be
69 * specified as they should appear in source code. For example:
70 * <code>"String"</code>, <code>"int[]"</code>, or <code>"java.io.File"</code>.
72 * @param typeName the type name
73 * @exception IllegalArgumentException if <code>null</code> is specified
75 public void setType(String typeName) throws IllegalArgumentException;