[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Wed Feb 21 11:58:41 EST 2007
User: gavin
Date: 07/02/21 11:58:41
Modified: src/main/org/jboss/seam Component.java
Log:
JBSEAM-893
Revision Changes Path
1.238 +14 -4 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -b -r1.237 -r1.238
--- Component.java 14 Feb 2007 05:46:29 -0000 1.237
+++ Component.java 21 Feb 2007 16:58:41 -0000 1.238
@@ -179,7 +179,7 @@
//only used for tests
public Component(Class<?> clazz)
{
- this( clazz, Seam.getComponentName(clazz) );
+ this( clazz, getComponentName(clazz) );
}
// only used for tests
@@ -191,7 +191,7 @@
// only used for tests
public Component(Class<?> clazz, Context applicationContext)
{
- this( clazz, Seam.getComponentName(clazz), Seam.getComponentScope(clazz), null, applicationContext );
+ this( clazz, getComponentName(clazz), Seam.getComponentScope(clazz), null, applicationContext );
}
public Component(Class<?> clazz, String componentName, ScopeType componentScope, String jndiName)
@@ -1514,6 +1514,16 @@
}
}
+ public static String getComponentName(Class<?> clazz)
+ {
+ String componentName = Seam.getComponentName(clazz);
+ if (componentName==null)
+ {
+ throw new IllegalArgumentException("No @Name annotation for class: " + clazz.getName());
+ }
+ return componentName;
+ }
+
public static Component forName(String name)
{
if ( !Contexts.isApplicationContextActive() )
@@ -1530,7 +1540,7 @@
public static Object getInstance(Class<?> clazz, boolean create)
{
- return getInstance( Seam.getComponentName(clazz), create );
+ return getInstance( getComponentName(clazz), create );
}
public static Object getInstance(Class<?> clazz, ScopeType scope)
@@ -1540,7 +1550,7 @@
public static Object getInstance(Class<?> clazz, ScopeType scope, boolean create)
{
- return getInstance( Seam.getComponentName(clazz), scope, create );
+ return getInstance( getComponentName(clazz), scope, create );
}
public static Object getInstance(String name)
More information about the jboss-cvs-commits
mailing list