}
AnnotatedTypeBuilder<X> builder = null;
// support for @Named packages
Named namedFromPackage = null;
if (pkg != null && pkg.isAnnotationPresent(Named.class) && !annotatedType.isAnnotationPresent(Named.class))
{
builder = initializeBuilder(builder, annotatedType);
namedFromPackage = new NamedLiteral();
builder.addToClass(namedFromPackage);
}
FullyQualified qualifiedOnPackage = null;
if (pkg != null)
{
qualifiedOnPackage = pkg.getAnnotation(FullyQualified.class);
}
// support for @FullyQualified bean names on type (respect @Named if added by previous operation)
if ((namedFromPackage != null || annotatedType.isAnnotationPresent(Named.class)) &&
(qualifiedOnPackage != null || annotatedType.isAnnotationPresent(FullyQualified.class)))
{
builder = initializeBuilder(builder, annotatedType);
String name = (namedFromPackage != null ? namedFromPackage.value() : annotatedType.getAnnotation(Named.class).value());
if (name.length() == 0)
{
name = deriveBeanNameForType(javaClass);
}
Package targetPackage = resolveTargetPackage(annotatedType.getAnnotation(FullyQualified.class), qualifiedOnPackage, pkg);