Class TypeVariable.Builder

    • Field Detail

      • identifier

        private final java.lang.String identifier
      • bounds

        private final java.util.List<Type> bounds
      • hasImplicitObjectBound

        private boolean hasImplicitObjectBound
    • Constructor Detail

      • Builder

        Builder​(java.lang.String identifier)
    • Method Detail

      • implicitObjectBound

        public TypeVariable.Builder implicitObjectBound()
        Marks the built type variable as having an implicit (not declared) bound of Object. It follows that all bounds added via addBound(Type), if any, are interface types. The erasure of the type variable is not necessarily Object though; if any interface bounds are added via addBound(Type), the first such interface type is the erasure.
        Returns:
        this builder
        Since:
        3.3.2
      • addBound

        public TypeVariable.Builder addBound​(Type bound)
        Adds a bound. The first bound may be a class type or a type variable. If the first bound is a class type (or if the type variable has an implicitObjectBound()), the subsequent bounds must be interface types. If the first bound is a type variable, there may be no subsequent bounds.
        Parameters:
        bound - the bound, must not be null
        Returns:
        this builder
      • addBound

        public TypeVariable.Builder addBound​(java.lang.Class<?> clazz)
        Adds a bound. The first bound may be a class type or a type variable. If the first bound is a class type (or if the type variable has an implicitObjectBound()), the subsequent bounds must be interface types. If the first bound is a type variable, there may be no subsequent bounds.
        Parameters:
        clazz - the class whose type is added as a bound, must not be null
        Returns:
        this builder
      • build

        public TypeVariable build()
        Returns the built type variable.
        Returns:
        the built type variable