Package 

Interface WildcardMirror

    • Method Detail

      • withTypeAnnotations

         abstract WildcardMirror withTypeAnnotations(List<Annotation> annotations)

        Creates a copy of this type mirror that has been specialized to have the passed Type Annotations. Type annotations on this mirror will not carry over to the resulting mirror.

        Note that are not the annotations present on the class declaration, they are the annotations present on the use of the type.

      • getCoreAnnotatedType

         abstract AnnotatedWildcardType getCoreAnnotatedType()

        The Java Core Reflection annotated type this mirror represents.

        !!NOTE!! The JVM implementations of AnnotatedType don't implement equals or hashCode, so they will equal neither each other nor this. If you need these methods pass any annotated type through Mirror.toCanonical.

      • getRaw

         abstract WildcardMirror getRaw()

        The mirror representing this type without any generic specialization

      • getLowerBounds

         abstract List<TypeMirror> getLowerBounds()

        ? super T or out T. The lowermost type in the hierarchy that is valid. Any valid type must be a supertype of T. The current language spec only allows for one, but the Core Reflection API supports multiple for future-proofing reasons.

        In plain english, a lower bounded wildcard represents "somewhere I can put a < bound >", as opposed to upper bounded wildcards being "some kind of < bound >".

        For `? super AbstractList`
        - Object          - Valid   - `Object myVar = myAbstractList;` compiles
        - List            - Valid   - `List myVar = myAbstractList;` compiles
        * AbstractList    - Valid   - `AbstractList myVar = myAbstractList;` compiles
        - ArrayList       - Invalid - `ArrayList myVar = myAbstractList;` does not compile
      • getLowerBound

         abstract TypeMirror getLowerBound()

        ? super T or out T. The lowermost type in the hierarchy that is valid. Any valid type must be a supertype of T. This is a shorthand for the first element of lowerBounds, if it exists, as currently that is the only one supported by the language.

        In plain english, a lower bounded wildcard represents "somewhere I can put a < bound >", as opposed to upper bounded wildcards being "some kind of < bound >".

        For `? super AbstractList`
        - Object          - Valid   - `Object myVar = myAbstractList;` compiles
        - List            - Valid   - `List myVar = myAbstractList;` compiles
        * AbstractList    - Valid   - `AbstractList myVar = myAbstractList;` compiles
        - ArrayList       - Invalid - `ArrayList myVar = myAbstractList;` does not compile
      • getUpperBounds

         abstract List<TypeMirror> getUpperBounds()

        ? extends T or in T. The uppermost type in the hierarchy that is valid. Any valid type must be a subclass of and implement the interfaces in upperBounds. The current language spec only allows for one, but the Core Reflection API supports multiple for future-proofing reasons.

        In plain english, an upper bounded wildcard represents "some kind of < bound >", as opposed to lower bounded wildcards being "somewhere I can put a < bound >".

        For `? extends List`
        - Object          - Invalid - `public List foo() { return myObject; }` does not compile
        * List            - Valid   - `public List foo() { return myList; }` compiles
        - AbstractList    - Valid   - `public List foo() { return myAbstractList; }` compiles
        - ArrayList       - Valid   - `public List foo() { return myArrayList; }` compiles
      • getUpperBound

         abstract TypeMirror getUpperBound()

        ? extends T or in T. The uppermost type in the hierarchy that is valid. Any valid type must be a subclass of or implement the classes in upperBounds. This is a shorthand for the first element of upperBounds, if it exists, as currently that is the only one supported by the language.

        In plain english, an upper bounded wildcard represents "some kind of < bound >", as opposed to lower bounded wildcards being "somewhere I can put a < bound >".

        For `? extends List`
        - Object          - Invalid - `public List foo() { return myObject; }` does not compile
        * List            - Valid   - `public List foo() { return myList; }` compiles
        - AbstractList    - Valid   - `public List foo() { return myAbstractList; }` compiles
        - ArrayList       - Valid   - `public List foo() { return myArrayList; }` compiles