1 /* 2 * @(#)FieldDeclaration.java 1.2 04/04/20 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package com.sun.mirror.declaration; 9 10 11 import com.sun.mirror.type.TypeMirror; 12 13 14 /** 15 * Represents a field of a type declaration. 16 * 17 * @author Joseph D. Darcy 18 * @author Scott Seligman 19 * @version 1.2 04/04/20 20 * @since 1.5 21 */ 22 23 public interface FieldDeclaration extends MemberDeclaration { 24 25 /** 26 * Returns the type of this field. 27 * 28 * @return the type of this field 29 */ 30 TypeMirror getType(); 31 32 /** 33 * Returns the value of this field if this field is a compile-time 34 * constant. Returns <tt>null</tt> otherwise. 35 * The value will be of a primitive type or <tt>String</tt>. 36 * If the value is of a primitive type, it is wrapped in the 37 * appropriate wrapper class (such as {@link Integer}). 38 * 39 * @return the value of this field if this field is a compile-time 40 * constant, or <tt>null</tt> otherwise 41 */ 42 Object getConstantValue(); 43 44 /** 45 * Returns the text of a <i>constant expression</i> representing the 46 * value of this field if this field is a compile-time constant. 47 * Returns <tt>null</tt> otherwise. 48 * The value will be of a primitive type or <tt>String</tt>. 49 * The text returned is in a form suitable for representing the value 50 * in source code. 51 * 52 * @return the text of a constant expression if this field is a 53 * compile-time constant, or <tt>null</tt> otherwise 54 */ 55 String getConstantExpression(); 56 } 57