001: /*******************************************************************************
002: * Copyright (c) 2000, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: * IBM Corporation - added J2SE 1.5 support
011: *******************************************************************************/package org.eclipse.jdt.core;
012:
013: /**
014: * Represents a field declared in a type.
015: * <p>
016: * This interface is not intended to be implemented by clients.
017: * </p>
018: */
019: public interface IField extends IMember {
020: /**
021: * Returns the constant value associated with this field
022: * or <code>null</code> if this field has none. The field needs to be static and final to have
023: * a constant value.
024: * Returns an instance of the wrapper type corresponding to the the type of the field.
025: * <table border="1">
026: * <tr>
027: * <th>field type</th>
028: * <th>wrapper type</th>
029: * </tr>
030: * <tr>
031: * <td>int
032: * </td>
033: * <td>java.lang.Integer
034: * </td>
035: * </tr>
036: * <tr>
037: * <td>byte
038: * </td>
039: * <td>java.lang.Byte
040: * </td>
041: * </tr>
042: * <tr>
043: * <td>boolean
044: * </td>
045: * <td>java.lang.Boolean
046: * </td>
047: * </tr>
048: * <tr>
049: * <td>char
050: * </td>
051: * <td>java.lang.Character
052: * </td>
053: * </tr>
054: * <tr>
055: * <td>double
056: * </td>
057: * <td>java.lang.Double
058: * </td>
059: * </tr>
060: * <tr>
061: * <td>float
062: * </td>
063: * <td>java.lang.Float
064: * </td>
065: * </tr>
066: * <tr>
067: * <td>long
068: * </td>
069: * <td>java.lang.Long
070: * </td>
071: * </tr>
072: * <tr>
073: * <td>short
074: * </td>
075: * <td>java.lang.Short
076: * </td>
077: * </tr>
078: * <tr>
079: * <td>java.lang.String
080: * </td>
081: * <td>java.lang.String
082: * </td>
083: * </tr>
084: * </table>
085: *
086: * @return the constant value associated with this field or <code>null</code> if this field has none.
087: * @exception JavaModelException if this element does not exist or if an
088: * exception occurs while accessing its corresponding resource
089: */
090: public Object getConstant() throws JavaModelException;
091:
092: /**
093: * Returns the simple name of this field.
094: * @return the simple name of this field.
095: */
096: String getElementName();
097:
098: /**
099: * Returns the binding key for this field. A binding key is a key that uniquely
100: * identifies this field. It allows access to generic info for parameterized
101: * fields.
102: *
103: * @return the binding key for this field
104: * @see org.eclipse.jdt.core.dom.IBinding#getKey()
105: * @see BindingKey
106: * @since 3.1
107: */
108: String getKey();
109:
110: /**
111: * Returns the type signature of this field. For enum constants,
112: * this returns the signature of the declaring enum class.
113: * <p>
114: * The type signature may be either unresolved (for source types)
115: * or resolved (for binary types), and either basic (for basic types)
116: * or rich (for parameterized types). See {@link Signature} for details.
117: * </p>
118: *
119: * @return the type signature of this field
120: * @exception JavaModelException if this element does not exist or if an
121: * exception occurs while accessing its corresponding resource
122: * @see Signature
123: */
124: String getTypeSignature() throws JavaModelException;
125:
126: /**
127: * Returns whether this field represents an enum constant.
128: *
129: * @return whether this field represents an enum constant
130: * @exception JavaModelException if this element does not exist or if an
131: * exception occurs while accessing its corresponding resource
132: * @since 3.1
133: */
134: boolean isEnumConstant() throws JavaModelException;
135:
136: /**
137: * Returns whether this field represents a resolved field.
138: * If a field is resoved, its key contains resolved information.
139: *
140: * @return whether this field represents a resolved field.
141: * @since 3.1
142: */
143: boolean isResolved();
144:
145: }
|