]
Lukas Jungmann closed JBIDE-8200.
---------------------------------
v. M2
Support @FullyQualified annotation
----------------------------------
Key: JBIDE-8200
URL:
https://issues.jboss.org/browse/JBIDE-8200
Project: Tools (JBoss Tools)
Issue Type: Sub-task
Components: cdi (jsr-299)
Reporter: Alexey Kazakov
Assignee: Viacheslav Kabanovich
Labels: new_and_noteworthy
Fix For: 3.3.0.M1
2.5. @FullyQualified bean names
According to the CDI standard, the @Named annotation assigns a name to a bean equal to
the value specified in the @Named annotation or, if a value is not provided, the simple
name of the bean class. This behavior aligns is with the needs of most application
developers. However, framework writers should avoid trampling on the "root" bean
namespace. Instead, frameworks should specify qualified names for built-in components. The
motivation is the same as qualifying Java types. The @FullyQualified provides this
facility without sacrificing type-safety.
Seam Solder allows you to customize the bean name using the complementary
@FullyQualified annotation. When the @FullyQualified annotation is added to a @Named bean
type, producer method or producer field, the standard bean name is prefixed with the name
of the Java package in which the bean resides, the segments separated by a period. The
resulting fully-qualified bean name (FQBN) replaces the standard bean name.
package com.acme;
@FullyQualified @Named
public class NamedBean {
public String getAge() {
return 5;
}
}
The bean in the previous code listing is assigned the name com.acme.namedBean. The value
of its property age would be referenced in an EL expression (perhaps in a JSF view
template) as follows:
#{com.acme.namedBean.age}
The @FullyQualified annotation is permitted on a bean type, producer method or producer
field. It can also be used on a Java package, in which case all @Named beans in that
package get a bean name which is fully-qualified.
@FullyQualified
package com.acme;
If you want to use a different Java package as the namespace of the bean, rather than the
Java package of the bean, you specify any class in that alternative package in the
annotation value.
package com.acme;
@FullyQualified(ClassInOtherPackage.class) @Named
public class CustomNamespacedNamedBean {
...
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: