Hi,
I habe been studying Seam framework for a long time. Altough i do not use it at work, i like its approach. It is very interesting. But i have some doubts. After reading Seam in Action book, i think it is not possible you bind more than one parameter to a business method. Something like
@Stateless
public class BusinessObjectImpl implements BusinessObject {
public void doSomething(SomeObject i01, SomeObject i02 and so on...) {
}
}
Am i right ? Because of it, you have two approachs:
- @In (for injection) and @Out (for outjection)
//
@Stateless
public class BusinessObjectImpl implements BusinessObject {
@In
private SomeObject input01;
@In
private SomeObject input02;
@In
private SomeObject input03;
@Out
private SomeObject output01;
@Out
private SomeObject output02;
@Out
private SomeObject output03;
public void doSomething() {
// some code
}
}
- You can use Seam Context
//
@Stateless
public class BusinessObjectImpl implements BusinessObject {
public void doSomething() {
SomeObject input = Context.get("contextualName");
SomeObject output ...
Context.set("contextualName", output);
}
}
If the first approach is used in a Stateless where it has many methods, so i think it is better you model your business object by using Command pattern. Am i right ? Something like
public class DoSomething implements Command {
@In
private SomeObject input01;
@In
private SomeObject input02;
@Out
private SomeObject output01;
public void execute() {
}
}
And you: what pattern (and good practices) do you use to avoid many member fields in a Stateless business object ?
regards,