Module org.scijava.ops.engine
Class MatchingUtils.TypeVarInfo
- java.lang.Object
-
- org.scijava.ops.engine.matcher.impl.MatchingUtils.TypeVarInfo
-
- Enclosing class:
- MatchingUtils
public static class MatchingUtils.TypeVarInfo extends Object
Maintains info about aTypeVariable.
-
-
Constructor Summary
Constructors Constructor Description TypeVarInfo(TypeVariable<?> var)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowType(Type type, boolean refuseWildcards)Adds the type of thisMatchingUtils.TypeVarInfoto the type parameter, if it is allowed.booleanfixBounds(Type bound, boolean refuseWildcards)If aTypeVariableis used in aParameterizedType, the bounds have to be fixed such that the upperBound is theTypeparameterizing thatParameterizedType.StringtoString()booleantypesContainWildcard()booleanwildcardAllowedInParameterizedType(Type type)
-
-
-
Constructor Detail
-
TypeVarInfo
public TypeVarInfo(TypeVariable<?> var)
-
-
Method Detail
-
typesContainWildcard
public boolean typesContainWildcard()
-
wildcardAllowedInParameterizedType
public boolean wildcardAllowedInParameterizedType(Type type)
-
allowType
public boolean allowType(Type type, boolean refuseWildcards)
Adds the type of thisMatchingUtils.TypeVarInfoto the type parameter, if it is allowed. If the type parameter is not contained within the bounds of theTypeVariable, then we return false, and the type of theTypeVariableis not changed.NB: If this
TypeVariableis being used in aParameterizedTypethenfixBounds(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
boundis a wildcard and other types are already allowed
- Parameters:
type- - theTypewe are trying to assign to thisMatchingUtils.TypeVarInfo.- Returns:
boolean- false if theTypeis not assignable to thisTypeVarInfo
-
fixBounds
public boolean fixBounds(Type bound, boolean refuseWildcards)
If aTypeVariableis used in aParameterizedType, the bounds have to be fixed such that the upperBound is theTypeparameterizing thatParameterizedType. 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
boundis a wildcard and other types are already allowed
- Parameters:
bound-refuseWildcards-
-
-