Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@856 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
webbeans-ri/src/test/java/org/jboss/webbeans/tck/impl/BeansImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.jboss.webbeans.tck.impl; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import javax.webbeans.manager.Bean; | ||
|
||
import org.jboss.webbeans.CurrentManager; | ||
import org.jboss.webbeans.bean.AbstractClassBean; | ||
import org.jboss.webbeans.bean.EnterpriseBean; | ||
import org.jboss.webbeans.bean.ProducerMethodBean; | ||
import org.jboss.webbeans.bean.SimpleBean; | ||
import org.jboss.webbeans.tck.api.Beans; | ||
|
||
public class BeansImpl implements Beans | ||
{ | ||
|
||
public <T> Bean<T> createSimpleBean(Class<T> clazz) | ||
{ | ||
return SimpleBean.of(clazz, CurrentManager.rootManager()); | ||
} | ||
|
||
public <T> Bean<T> createProducerMethodBean(Method method, Bean<T> declaringBean) | ||
{ | ||
if (declaringBean instanceof AbstractClassBean) | ||
{ | ||
return ProducerMethodBean.of(method, (AbstractClassBean<?>) declaringBean, CurrentManager.rootManager()); | ||
} | ||
else | ||
{ | ||
throw new IllegalStateException("Cannot create a producer method from a bean that wasn't created by the RI " + declaringBean); | ||
} | ||
} | ||
|
||
public <T> Bean<T> createEnterpriseBean(Class<T> clazz) | ||
{ | ||
return EnterpriseBean.of(clazz, CurrentManager.rootManager()); | ||
} | ||
|
||
} |