1. /*
  2. * @(#)Modifier.java 1.1 04/01/26
  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. /**
  9. * Represents a modifier on the declaration of a program element such
  10. * as a class, method, or field.
  11. *
  12. * <p> Not all modifiers are applicable to all kinds of declarations.
  13. * When two or more modifiers appear in the source code of a declaration,
  14. * then it is customary, though not required, that they appear in the same
  15. * order as the constants listed in the detail section below.
  16. *
  17. * @author Joseph D. Darcy
  18. * @author Scott Seligman
  19. * @version 1.1 04/01/25
  20. * @since 1.5
  21. */
  22. public enum Modifier {
  23. // See JLS2 sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1.
  24. // java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
  25. /** The modifier <tt>public</tt> */ PUBLIC,
  26. /** The modifier <tt>protected</tt> */ PROTECTED,
  27. /** The modifier <tt>private</tt> */ PRIVATE,
  28. /** The modifier <tt>abstract</tt> */ ABSTRACT,
  29. /** The modifier <tt>static</tt> */ STATIC,
  30. /** The modifier <tt>final</tt> */ FINAL,
  31. /** The modifier <tt>transient</tt> */ TRANSIENT,
  32. /** The modifier <tt>volatile</tt> */ VOLATILE,
  33. /** The modifier <tt>synchronized</tt> */ SYNCHRONIZED,
  34. /** The modifier <tt>native</tt> */ NATIVE,
  35. /** The modifier <tt>strictfp</tt> */ STRICTFP;
  36. private String lowercase = null; // modifier name in lowercase
  37. /**
  38. * Returns this modifier's name in lowercase.
  39. */
  40. public String toString() {
  41. if (lowercase == null) {
  42. lowercase = name().toLowerCase(java.util.Locale.US);
  43. }
  44. return lowercase;
  45. }
  46. }