1. /*
  2. * @(#)WildcardType.java 1.3 04/01/12
  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. * WildcardType represents a wildcard type expression, such as
  10. * <tt>?</tt>, <tt>? extends Number</tt>, or <tt>? super Integer</tt>.
  11. *
  12. * @since 1.5
  13. */
  14. public interface WildcardType extends Type {
  15. /**
  16. * Returns an array of <tt>Type</tt> objects representing the upper
  17. * bound(s) of this type variable. Note that if no upper bound is
  18. * explicitly declared, the upper bound is <tt>Object</tt>.
  19. *
  20. * <p>For each upper bound B :
  21. * <ul>
  22. * <li>if B is a parameterized type or a type variable, it is created,
  23. * (see {@link java.lang.reflect.ParameterizedType ParameterizedType}
  24. * for the details of the creation process for parameterized types).
  25. * <li>Otherwise, B is resolved.
  26. * </ul>
  27. *
  28. * @return an array of Types representing the upper bound(s) of this
  29. * type variable
  30. * @throws TypeNotPresentException if any of the
  31. * bounds refers to a non-existent type declaration
  32. * @throws MalformedParameterizedTypeException if any of the
  33. * bounds refer to a parameterized type that cannot be instantiated
  34. * for any reason
  35. */
  36. Type[] getUpperBounds();
  37. /**
  38. * Returns an array of <tt>Type</tt> objects representing the
  39. * lower bound(s) of this type variable. Note that if no lower bound is
  40. * explicitly declared, the lower bound is the type of <tt>null</tt>.
  41. * In this case, a zero length array is returned.
  42. *
  43. * <p>For each lower bound B :
  44. * <ul>
  45. * <li>if B is a parameterized type or a type variable, it is created,
  46. * (see {@link java.lang.reflect.ParameterizedType ParameterizedType}
  47. * for the details of the creation process for parameterized types).
  48. * <li>Otherwise, B is resolved.
  49. * </ul>
  50. *
  51. * @return an array of Types representing the lower bound(s) of this
  52. * type variable
  53. * @throws TypeNotPresentException if any of the
  54. * bounds refers to a non-existent type declaration
  55. * @throws MalformedParameterizedTypeException if any of the
  56. * bounds refer to a parameterized type that cannot be instantiated
  57. * for any reason
  58. */
  59. Type[] getLowerBounds();
  60. // one or many? Up to language spec; currently only one, but this API
  61. // allows for generalization.
  62. }