1. /*
  2. * @(#)DeclaredType.java 1.6 04/06/07
  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.type;
  8. import java.util.Collection;
  9. import com.sun.mirror.declaration.TypeDeclaration;
  10. /**
  11. * Represents a declared type, either a class type or an interface type.
  12. * This includes parameterized types such as {@code java.util.Set<String>}
  13. * as well as raw types.
  14. *
  15. * <p> While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
  16. * of a class or interface, a <tt>DeclaredType</tt> represents a class
  17. * or interface <i>type</i>, the latter being a use of the former.
  18. * See {@link TypeDeclaration} for more on this distinction.
  19. *
  20. * <p> A <tt>DeclaredType</tt> may represent a type
  21. * for which details (declaration, supertypes, <i>etc.</i>) are unknown.
  22. * This may be the result of a processing error, such as a missing class file,
  23. * and is indicated by {@link #getDeclaration()} returning <tt>null</tt>.
  24. * Other method invocations on such an unknown type will not, in general,
  25. * return meaningful results.
  26. *
  27. * @author Joseph D. Darcy
  28. * @author Scott Seligman
  29. * @version 1.6 04/06/07
  30. * @since 1.5
  31. */
  32. public interface DeclaredType extends ReferenceType {
  33. /**
  34. * Returns the declaration of this type.
  35. *
  36. * <p> Returns null if this type's declaration is unknown. This may
  37. * be the result of a processing error, such as a missing class file.
  38. *
  39. * @return the declaration of this type, or null if unknown
  40. */
  41. TypeDeclaration getDeclaration();
  42. /**
  43. * Returns the type that contains this type as a member.
  44. * Returns <tt>null</tt> if this is a top-level type.
  45. *
  46. * <p> For example, the containing type of {@code O.I<S>}
  47. * is the type {@code O}, and the containing type of
  48. * {@code O<T>.I<S>} is the type {@code O<T>}.
  49. *
  50. * @return the type that contains this type,
  51. * or <tt>null</tt> if this is a top-level type
  52. */
  53. DeclaredType getContainingType();
  54. /**
  55. * Returns (in order) the actual type arguments of this type.
  56. * For a generic type nested within another generic type
  57. * (such as {@code Outer<String>.Inner<Number>}), only the type
  58. * arguments of the innermost type are included.
  59. *
  60. * @return the actual type arguments of this type, or an empty collection
  61. * if there are none
  62. */
  63. Collection<TypeMirror> getActualTypeArguments();
  64. /**
  65. * Returns the interface types that are direct supertypes of this type.
  66. * These are the interface types implemented or extended
  67. * by this type's declaration, with any type arguments
  68. * substituted in.
  69. *
  70. * <p> For example, the interface type extended by
  71. * {@code java.util.Set<String>} is {@code java.util.Collection<String>}.
  72. *
  73. * @return the interface types that are direct supertypes of this type,
  74. * or an empty collection if there are none
  75. */
  76. Collection<InterfaceType> getSuperinterfaces();
  77. }