]
George Gastaldi closed FORGE-1792.
----------------------------------
Fix Version/s: 2.17.1.Final
(was: 2.x Future)
Resolution: Done
Add scopes to a the faces-new-bean command
------------------------------------------
Key: FORGE-1792
URL:
https://issues.jboss.org/browse/FORGE-1792
Project: Forge
Issue Type: Sub-task
Components: Java EE
Affects Versions: 2.5.0.Final
Reporter: Antonio Goncalves
Assignee: Antonio Goncalves
Labels: Starter
Fix For: 2.17.1.Final
The command {{faces-new-bean}} should be able to add a scope. Then, depending on the
scope, the generated code would be different (e.g. implements Serializable for most of the
other stateful scopes)
{code}
faces-new-bean --named MyBean --scoped SESSION
{code}
This would generate the following code
{code}
@Named
@SessionScoped
public class MyBean implements Serializable {
}
{code}
For the conversation scope we could add more code :
{code}
faces-new-bean --named MyBean --scoped Conversation
{code}
This would generate the following code
{code}
@Named
@ConversationScoped
public class MyBean implements Serializable {
@Inject
private Conversation conversation;
public String begin() {
conversation.begin();
return null;
}
public String end() {
conversation.end();
return null;
}
}
{code}