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@272 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.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,63 @@ | ||
package org.jboss.webbeans.bean; | ||
|
||
import org.jboss.webbeans.ManagerImpl; | ||
import org.jboss.webbeans.injectable.InjectableField; | ||
import org.jboss.webbeans.injectable.InjectableMethod; | ||
import org.jboss.webbeans.model.bean.EnterpriseBeanModel; | ||
|
||
public class EnterpriseBean<T> extends AbstractBean<T> | ||
{ | ||
private EnterpriseBeanModel<T> model; | ||
|
||
public EnterpriseBean(EnterpriseBeanModel<T> model, ManagerImpl manager) { | ||
super(manager); | ||
this.model = model; | ||
} | ||
|
||
@Override | ||
public EnterpriseBeanModel<T> getModel() | ||
{ | ||
return model; | ||
} | ||
|
||
@Override | ||
public T create() | ||
{ | ||
T instance = model.getConstructor().invoke(manager); | ||
bindDecorators(); | ||
bindInterceptors(); | ||
injectEjbAndCommonFields(); | ||
injectBoundFields(instance); | ||
callInitializers(instance); | ||
return instance; | ||
} | ||
|
||
@Override | ||
public void destroy(T instance) | ||
{ | ||
// TODO Auto-generated method stub | ||
super.destroy(instance); | ||
} | ||
|
||
protected void callInitializers(T instance) | ||
{ | ||
for (InjectableMethod<Object> initializer : model.getInitializerMethods()) | ||
{ | ||
initializer.invoke(manager, instance); | ||
} | ||
} | ||
|
||
protected void injectEjbAndCommonFields() | ||
{ | ||
// TODO | ||
} | ||
|
||
protected void injectBoundFields(T instance) | ||
{ | ||
for (InjectableField<?> injectableField : getModel().getInjectableFields()) | ||
{ | ||
injectableField.inject(instance, manager); | ||
} | ||
} | ||
|
||
} |
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