Class MatchingUtils.TypeVarInfo

    • Constructor Detail

    • Method Detail

      • typesContainWildcard

        public boolean typesContainWildcard()
      • wildcardAllowedInParameterizedType

        public boolean wildcardAllowedInParameterizedType​(Type type)
      • allowType

        public boolean allowType​(Type type,
                                 boolean refuseWildcards)
        Adds the type of this MatchingUtils.TypeVarInfo to the type parameter, if it is allowed. If the type parameter is not contained within the bounds of the TypeVariable, then we return false, and the type of the TypeVariable is not changed.

        NB: If this TypeVariable is being used in a ParameterizedType then fixBounds(java.lang.reflect.Type, boolean) should be used instead. Furthermore, it can be specified if wildcards should be refused, which means that the method will return false if:

        • a wildcard is already allowed for this type var
        • bound is a wildcard and other types are already allowed
        This is useful if the type variable was contained in a parameterized type, hence it only allows wildcards if it was not bound to a type yet.
        Parameters:
        type - - the Type we are trying to assign to this MatchingUtils.TypeVarInfo.
        Returns:
        boolean - false if the Type is not assignable to this TypeVarInfo
      • fixBounds

        public boolean fixBounds​(Type bound,
                                 boolean refuseWildcards)
        If a TypeVariable is used in a ParameterizedType, the bounds have to be fixed such that the upperBound is the Type parameterizing that ParameterizedType. Furthermore, it can be specified if wildcards should be refused, which means that the method will return false if:
        • a wildcard is already allowed for this type var
        • bound is a wildcard and other types are already allowed
        This is useful if the type variable was contained in a parameterized type, hence it only allows wildcards if it was not bound to a type yet.
        Parameters:
        bound -
        refuseWildcards -