[
https://jira.jboss.org/jira/browse/JBIDE-3136?page=com.atlassian.jira.plu...
]
Dan Allen commented on JBIDE-3136:
----------------------------------
My focus is on getting that @Decorates field created at the time the class is created
through the use of an Eclipse form. It's also I think about raising awareness for the
decorator.
So the idea would be, I have a Web Bean open and a right click on an interface and say
"create decorator for interface". Then I get the standard class-from-interface
dialogs. But when the class is created, it has a
@Decorates field that matches the Web Bean I had opened. Perhaps I can even pick which
methods I want to decorate and the body is filled out with a call to the target method.
New decorator from existing Web Bean
------------------------------------
Key: JBIDE-3136
URL:
https://jira.jboss.org/jira/browse/JBIDE-3136
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: webbeans
Reporter: Dan Allen
Fix For: LATER
Suppose we have an interface that represents accounts:
public interface Account {
public BigDecimal getBalance();
public User getOwner();
public void withdraw(BigDecimal amount);
public void deposit(BigDecimal amount);
}
A decorator is a simple Web Bean that implements the type it decorates and is annotated
@Decorator.
@Decorator
public abstract class LargeTransactionDecorator
implements Account {
@Decorates Account account;
@PersistenceContext EntityManager em;
public void withdraw(BigDecimal amount) {
account.withdraw(amount);
if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
em.persist( new LoggedWithdrawl(amount) );
}
}
public void deposit(BigDecimal amount);
account.deposit(amount);
if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
em.persist( new LoggedDeposit(amount) );
}
}
}
The tooling would not only help you create the class that acts as the decorator, but make
sure that it implements the same interfaces as the Web Beans and injects the Web Bean into
a @Decorates field.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira