* @param component configuring web beans component
* @param defaultName default name of the web bean
*/
public static <T> void defineName(AbstractComponent<T> component, Annotation[] anns, String defaultName)
{
Named nameAnnot = null;
boolean isDefault = false;
for (Annotation ann : anns)
{
if (ann.annotationType().equals(Named.class))
{
nameAnnot = (Named) ann;
break;
}
}
if (nameAnnot == null) // no @Named
{
// Check for stereottype
if (WebBeansUtil.isNamedExistOnStereoTypes(component))
{
isDefault = true;
}
}
else
// yes @Named
{
if (nameAnnot.value().equals(""))
{
isDefault = true;
}
else
{
component.setName(nameAnnot.value());
}
}
if (isDefault)