You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2008/02/01 01:21:05 UTC
[Myfaces Wiki] Update of "Code Generation" by AndrewRobinson
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by AndrewRobinson:
http://wiki.apache.org/myfaces/Code_Generation
The comment on the change is:
Add code gen w/ annotations approach
------------------------------------------------------------------------------
* http://java-source.net/open-source/parser-generators
* http://ws.apache.org/jaxme/js/jparser.html
+ === Combining annotations with a code generator approach ===
+
+ {{{#!java
+ @Component(
+ type = "...",
+ family = "...",
+ rendererType = "...",
+ tagClass = "...",
+ events = {
+ @ComponentEvent(
+ type = "...",
+ phases = { "...", "..." }),
+ ...
+ )
+ public abstract class MyComponent extends UIXComponent
+ {
+ @ComponentProperty(
+ description = "or is this better in javadoc? -- harder to code the generator, but easier to document",
+ extensions = {
+ @PropertyExtension(name = "preferred", value = Boolean.TRUE),
+ @PropertyExtension(name = "...", value = "...")
+ })
+ private String _foo;
+
+ @ComponentPropertySkel
+ public abstract String getFoo();
+
+ public void broadcast(FacesEvent event)
+ {
+ if ("bar".equals(getFoo()) {
+ // custom code
+ }
+ }
+ }
+ }}}
+ This would be in a pre-processing folder of maven (not src/main/java). The plugin can then take this file an build the concrete class from it.
+
+ This is basically the same as the trinidad approach but it merges the xml with the template.
+
+
=== Other notes ===
Some interest was expressed in passing about making jsf component setters/getters use java5 generics.