1. /*
  2. * @(#)ParameterizedType.java 1.4 04/02/06
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.lang.reflect;
  8. /**
  9. * ParameterizedType represents a parameterized type such as
  10. * Collection<String>.
  11. *
  12. * <p>A parameterized type is created the first time it is needed by a
  13. * reflective method, as specified in this package. When a
  14. * parameterized type p is created, the generic type declaration that
  15. * p instantiates is resolved, and all type arguments of p are created
  16. * recursively. See {@link java.lang.reflect.TypeVariable
  17. * TypeVariable} for details on the creation process for type
  18. * variables. Repeated creation of a parameterized type has no effect.
  19. *
  20. * <p>Instances of classes that implement this interface must implement
  21. * an equals() method that equates any two instances that share the
  22. * same generic type declaration and have equal type parameters.
  23. *
  24. * @since 1.5
  25. */
  26. public interface ParameterizedType extends Type {
  27. /**
  28. * Returns an array of <tt>Type</tt> objects representing the actual type
  29. * arguments to this type.
  30. *
  31. * <p>Note that in some cases, the returned array be empty. This can occur
  32. * if this type represents a non-parameterized type nested within
  33. * a parameterized type.
  34. *
  35. * @return an array of <tt>Type</tt> objects representing the actual type
  36. * arguments to this type
  37. * @throws <tt>TypeNotPresentException</tt> if any of the
  38. * actual type arguments refers to a non-existent type declaration
  39. * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
  40. * actual type parameters refer to a parameterized type that cannot
  41. * be instantiated for any reason
  42. * @since 1.5
  43. */
  44. Type[] getActualTypeArguments();
  45. /**
  46. * Returns the <tt>Type</tt> object representing the class or interface
  47. * that declared this type.
  48. *
  49. * @return the <tt>Type</tt> object representing the class or interface
  50. * that declared this type
  51. * @since 1.5
  52. */
  53. Type getRawType();
  54. /**
  55. * Returns a <tt>Type</tt> object representing the type that this type
  56. * is a member of. For example, if this type is {@code O<T>.I<S>},
  57. * return a representation of {@code O<T>}.
  58. *
  59. * <p>If this type is a top-level type, <tt>null</tt> is returned.
  60. *
  61. * @return a <tt>Type</tt> object representing the type that
  62. * this type is a member of. If this type is a top-level type,
  63. * <tt>null</tt> is returned
  64. * @throws <tt>TypeNotPresentException</tt> if the owner type
  65. * refers to a non-existent type declaration
  66. * @throws <tt>MalformedParameterizedTypeException</tt> if the owner type
  67. * refers to a parameterized type that cannot be instantiated
  68. * for any reason
  69. * @since 1.5
  70. */
  71. Type getOwnerType();
  72. }