WildcardType
Stay organized with collections
Save and categorize content based on your preferences.
WildcardType represents a wildcard type expression, such as
?
, ? extends Number
, or ? super Integer
.
Public Method Summary
abstract
Type[]
|
getLowerBounds()
Returns an array of Type objects representing the
lower bound(s) of this type variable.
|
abstract
Type[]
|
getUpperBounds()
Returns an array of Type objects representing the upper
bound(s) of this type variable.
|
Public Methods
public
abstract
Type[]
getLowerBounds
()
Returns an array of Type
objects representing the
lower bound(s) of this type variable. Note that if no lower bound is
explicitly declared, the lower bound is the type of null
.
In this case, a zero length array is returned.
For each lower bound B :
- if B is a parameterized type or a type variable, it is created,
(see
ParameterizedType
for the details of the creation process for parameterized types).
- Otherwise, B is resolved.
Returns
- an array of Types representing the lower bound(s) of this
type variable
public
abstract
Type[]
getUpperBounds
()
Returns an array of Type
objects representing the upper
bound(s) of this type variable. Note that if no upper bound is
explicitly declared, the upper bound is Object
.
For each upper bound B :
- if B is a parameterized type or a type variable, it is created,
(see
ParameterizedType
for the details of the creation process for parameterized types).
- Otherwise, B is resolved.
Returns
- an array of Types representing the upper bound(s) of this
type variable
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eWildcardType\u003c/code\u003e represents wildcard type expressions like \u003ccode\u003e?\u003c/code\u003e, \u003ccode\u003e? extends Number\u003c/code\u003e, or \u003ccode\u003e? super Integer\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to get the lower and upper bounds of the wildcard type.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetLowerBounds()\u003c/code\u003e returns an array of \u003ccode\u003eType\u003c/code\u003e objects representing the lower bound(s), defaulting to \u003ccode\u003enull\u003c/code\u003e if not explicitly declared.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetUpperBounds()\u003c/code\u003e returns an array of \u003ccode\u003eType\u003c/code\u003e objects representing the upper bound(s), defaulting to \u003ccode\u003eObject\u003c/code\u003e if not explicitly declared.\u003c/p\u003e\n"]]],[],null,["public interface **WildcardType** implements [Type](../../../../reference/java/lang/reflect/Type.html) \nWildcardType represents a wildcard type expression, such as\n`?`, `? extends Number`, or `? super Integer`. \n\nPublic Method Summary\n\n|------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Type\\[\\]](../../../../reference/java/lang/reflect/Type.html) | [getLowerBounds](../../../../reference/java/lang/reflect/WildcardType.html#getLowerBounds())() Returns an array of `Type` objects representing the lower bound(s) of this type variable. |\n| abstract [Type\\[\\]](../../../../reference/java/lang/reflect/Type.html) | [getUpperBounds](../../../../reference/java/lang/reflect/WildcardType.html#getUpperBounds())() Returns an array of `Type` objects representing the upper bound(s) of this type variable. |\n\nPublic Methods \n\npublic abstract [Type\\[\\]](../../../../reference/java/lang/reflect/Type.html)\n**getLowerBounds**\n() \nReturns an array of `Type` objects representing the\nlower bound(s) of this type variable. Note that if no lower bound is\nexplicitly declared, the lower bound is the type of `null`.\nIn this case, a zero length array is returned.\n\nFor each lower bound B :\n\n- if B is a parameterized type or a type variable, it is created, (see [ParameterizedType](../../../../reference/java/lang/reflect/ParameterizedType.html) for the details of the creation process for parameterized types).\n- Otherwise, B is resolved.\n\n\u003cbr /\u003e\n\nReturns\n\n- an array of Types representing the lower bound(s) of this type variable \n\nThrows\n\n| [TypeNotPresentException](../../../../reference/java/lang/TypeNotPresentException.html) | if any of the bounds refers to a non-existent type declaration |\n| [MalformedParameterizedTypeException](../../../../reference/java/lang/reflect/MalformedParameterizedTypeException.html) | if any of the bounds refer to a parameterized type that cannot be instantiated for any reason |\n|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|\n\npublic abstract [Type\\[\\]](../../../../reference/java/lang/reflect/Type.html)\n**getUpperBounds**\n() \nReturns an array of `Type` objects representing the upper\nbound(s) of this type variable. Note that if no upper bound is\nexplicitly declared, the upper bound is `Object`.\n\nFor each upper bound B :\n\n- if B is a parameterized type or a type variable, it is created, (see [ParameterizedType](../../../../reference/java/lang/reflect/ParameterizedType.html) for the details of the creation process for parameterized types).\n- Otherwise, B is resolved.\n\n\u003cbr /\u003e\n\nReturns\n\n- an array of Types representing the upper bound(s) of this type variable \n\nThrows\n\n| [TypeNotPresentException](../../../../reference/java/lang/TypeNotPresentException.html) | if any of the bounds refers to a non-existent type declaration |\n| [MalformedParameterizedTypeException](../../../../reference/java/lang/reflect/MalformedParameterizedTypeException.html) | if any of the bounds refer to a parameterized type that cannot be instantiated for any reason |\n|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|"]]