private Type[] getUppermostBounds(Type[] bounds) { // if a type variable (or wildcard) declares a bound which is a type variable, it can declare no other bound if (bounds[0] instanceof TypeVariable<?>) { return getUppermostTypeVariableBounds((TypeVariable<?>) bounds[0]); } return bounds; }
protected boolean lowerBoundsOfWildcardMatch(Type parameter, WildcardType requiredParameter) { return lowerBoundsOfWildcardMatch(new Type[] { parameter }, requiredParameter); }
@Override public boolean matches(Type requiredType, Set<? extends Type> beanTypes) { for (Type beanType : beanTypes) { if (matches(requiredType, beanType)) { return true; } } return false; }
protected boolean upperBoundsOfWildcardMatch(WildcardType requiredParameter, Type parameter) { return boundsMatch(requiredParameter.getUpperBounds(), new Type[] { parameter }); } }
/** * Returns <tt>true</tt> iff for each upper bound T, there is at least one bound from <tt>stricterUpperBounds</tt> * assignable to T. This reflects that <tt>stricterUpperBounds</tt> are at least as strict as <tt>upperBounds</tt> are. * <p> * Arguments passed to this method must be legal java bounds, i.e. bounds returned by {@link TypeVariable#getBounds()}, * {@link WildcardType#getUpperBounds()} or {@link WildcardType#getLowerBounds()}. */ protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) { // getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes // assignability rules do not reflect our needs upperBounds = getUppermostBounds(upperBounds); stricterUpperBounds = getUppermostBounds(stricterUpperBounds); for (Type upperBound : upperBounds) { if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) { return false; } } return true; }
protected boolean upperBoundsOfWildcardMatch(WildcardType requiredParameter, Type parameter) { return boundsMatch(requiredParameter.getUpperBounds(), new Type[] { parameter }); } }
/** * Returns <tt>true</tt> iff for each upper bound T, there is at least one bound from <tt>stricterUpperBounds</tt> * assignable to T. This reflects that <tt>stricterUpperBounds</tt> are at least as strict as <tt>upperBounds</tt> are. * <p> * Arguments passed to this method must be legal java bounds, i.e. bounds returned by {@link TypeVariable#getBounds()}, * {@link WildcardType#getUpperBounds()} or {@link WildcardType#getLowerBounds()}. */ protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) { // getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes // assignability rules do not reflect our needs upperBounds = getUppermostBounds(upperBounds); stricterUpperBounds = getUppermostBounds(stricterUpperBounds); for (Type upperBound : upperBounds) { if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) { return false; } } return true; }
private Type[] getUppermostBounds(Type[] bounds) { // if a type variable (or wildcard) declares a bound which is a type variable, it can declare no other bound if (bounds[0] instanceof TypeVariable<?>) { return getUppermostTypeVariableBounds((TypeVariable<?>) bounds[0]); } return bounds; }
protected boolean lowerBoundsOfWildcardMatch(Type[] beanParameterBounds, WildcardType requiredParameter) { if (requiredParameter.getLowerBounds().length > 0) { Type[] lowerBounds = requiredParameter.getLowerBounds(); if (!boundsMatch(beanParameterBounds, lowerBounds)) { return false; } } return true; }
@Override public boolean matches(Set<Type> requiredTypes, Set<Type> beanTypes) { for (Type requiredType : requiredTypes) { if (matches(requiredType, beanTypes)) { return true; } } return false; }
protected boolean lowerBoundsOfWildcardMatch(Type parameter, WildcardType requiredParameter) { return lowerBoundsOfWildcardMatch(new Type[] { parameter }, requiredParameter); }
/** * Returns <tt>true</tt> iff for each upper bound T, there is at least one bound from <tt>stricterUpperBounds</tt> * assignable to T. This reflects that <tt>stricterUpperBounds</tt> are at least as strict as <tt>upperBounds</tt> are. * <p> * Arguments passed to this method must be legal java bounds, i.e. bounds returned by {@link TypeVariable#getBounds()}, * {@link WildcardType#getUpperBounds()} or {@link WildcardType#getLowerBounds()}. */ protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) { // getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes // assignability rules do not reflect our needs upperBounds = getUppermostBounds(upperBounds); stricterUpperBounds = getUppermostBounds(stricterUpperBounds); for (Type upperBound : upperBounds) { if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) { return false; } } return true; }
private Type[] getUppermostBounds(Type[] bounds) { // if a type variable (or wildcard) declares a bound which is a type variable, it can declare no other bound if (bounds[0] instanceof TypeVariable<?>) { return getUppermostTypeVariableBounds((TypeVariable<?>) bounds[0]); } return bounds; }
protected boolean upperBoundsOfWildcardMatch(WildcardType requiredParameter, Type parameter) { return boundsMatch(requiredParameter.getUpperBounds(), new Type[] { parameter }); } }
@Override public boolean matches(Type requiredType, Set<? extends Type> beanTypes) { for (Type beanType : beanTypes) { if (matches(requiredType, beanType)) { return true; } } return false; }
protected boolean lowerBoundsOfWildcardMatch(Type parameter, WildcardType requiredParameter) { return lowerBoundsOfWildcardMatch(new Type[] { parameter }, requiredParameter); }
/** * Returns <tt>true</tt> iff for each upper bound T, there is at least one bound from <tt>stricterUpperBounds</tt> * assignable to T. This reflects that <tt>stricterUpperBounds</tt> are at least as strict as <tt>upperBounds</tt> are. * <p> * Arguments passed to this method must be legal java bounds, i.e. bounds returned by {@link TypeVariable#getBounds()}, * {@link WildcardType#getUpperBounds()} or {@link WildcardType#getLowerBounds()}. */ protected boolean boundsMatch(Type[] upperBounds, Type[] stricterUpperBounds) { // getUppermostBounds to make sure that both arrays of bounds contain ONLY ACTUAL TYPES! otherwise, the CovariantTypes // assignability rules do not reflect our needs upperBounds = getUppermostBounds(upperBounds); stricterUpperBounds = getUppermostBounds(stricterUpperBounds); for (Type upperBound : upperBounds) { if (!CovariantTypes.isAssignableFromAtLeastOne(upperBound, stricterUpperBounds)) { return false; } } return true; }
private Type[] getUppermostBounds(Type[] bounds) { // if a type variable (or wildcard) declares a bound which is a type variable, it can declare no other bound if (bounds[0] instanceof TypeVariable<?>) { return getUppermostTypeVariableBounds((TypeVariable<?>) bounds[0]); } return bounds; }
protected boolean upperBoundsOfWildcardMatch(WildcardType requiredParameter, Type parameter) { return boundsMatch(requiredParameter.getUpperBounds(), new Type[] { parameter }); } }
@Override public boolean matches(Type requiredType, Set<? extends Type> beanTypes) { for (Type beanType : beanTypes) { if (matches(requiredType, beanType)) { return true; } } return false; }