{
if (type.isAssignableFrom(facetType))
{
if (Annotations.isAnnotationPresent(facetType, Alias.class))
result = (T) BeanManagerUtils.getContextualInstance(bm, facetType,
new AliasLiteral(ConstraintInspector.getName(facetType)));
else
result = (T) BeanManagerUtils.getContextualInstance(bm, facetType);
}
if (type.equals(facetType))
{
/**
* Ensure that if there is an exact match, we prefer it over other facet types.
*/
if (Annotations.isAnnotationPresent(facetType, Alias.class))
result = (T) BeanManagerUtils.getContextualInstance(bm, facetType,
new AliasLiteral(ConstraintInspector.getName(facetType)));
else
result = (T) BeanManagerUtils.getContextualInstance(bm, facetType);
break;
}
}