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. package com.sun.mirror.declaration;
  8. import com.sun.mirror.type.TypeMirror;
  9. /**
  10. * Represents a field of a type declaration.
  11. *
  12. * @author Joseph D. Darcy
  13. * @author Scott Seligman
  14. * @version 1.2 04/04/20
  15. * @since 1.5
  16. */
  17. public interface FieldDeclaration extends MemberDeclaration {
  18. /**
  19. * Returns the type of this field.
  20. *
  21. * @return the type of this field
  22. */
  23. TypeMirror getType();
  24. /**
  25. * Returns the value of this field if this field is a compile-time
  26. * constant. Returns <tt>null</tt> otherwise.
  27. * The value will be of a primitive type or <tt>String</tt>.
  28. * If the value is of a primitive type, it is wrapped in the
  29. * appropriate wrapper class (such as {@link Integer}).
  30. *
  31. * @return the value of this field if this field is a compile-time
  32. * constant, or <tt>null</tt> otherwise
  33. */
  34. Object getConstantValue();
  35. /**
  36. * Returns the text of a <i>constant expression</i> representing the
  37. * value of this field if this field is a compile-time constant.
  38. * Returns <tt>null</tt> otherwise.
  39. * The value will be of a primitive type or <tt>String</tt>.
  40. * The text returned is in a form suitable for representing the value
  41. * in source code.
  42. *
  43. * @return the text of a constant expression if this field is a
  44. * compile-time constant, or <tt>null</tt> otherwise
  45. */
  46. String getConstantExpression();
  47. }