]
Antonio Goncalves updated FORGE-1595:
-------------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request:
Being able to create an empty JSF backing bean
----------------------------------------------
Key: FORGE-1595
URL:
https://issues.jboss.org/browse/FORGE-1595
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.0.0.Final
Reporter: Antonio Goncalves
Assignee: Antonio Goncalves
Priority: Minor
Fix For: 2.x Future
At the moment the only way to generate JSF backing beans is with scaffolding. To save
time and help the developer in creating new backing beans, it would be good to have a
command such :
{code}
faces-new-bean --named MyBean
{code}
This will create a {{MyBean}}, of scope request, under the {{view}} package. You could
also give a different sub-package with :
{code}
faces-new-page --named MyBean --targetPackage view.admin
{code}
This will create the page under {{view/admin/MyBean.java}}.
{code}
@Named
@RequestScoped
public class MyBean {
}
{code}
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 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();
}
public String end() {
conversation.end();
}
}
{code}
PS : I'm on holidays skiing, and the internet connection is really bad. So I could
search for similar JIRAs if they existed