supporting javabean.attribute outside class-level tags and enums in property tags ---------------------------------------------------------------------------------
Key: XDT-1652 URL: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1652 Project: XDoclet Type: Improvement Components: Java Module Versions: 1.2.3 Reporter: Jean-Daniel Fekete Assigned to: xdoclet-devel (Use for new issues) have modified the java module to support attribute setting in method tags and started support for enum values in property tags. Attributes can be set to any level of annotation (class, method, property) so I didn't see any reason to limit it to class annotations. Enum can be documented using the "enumerationValues" attribute in javabean properties. This is not documented by Sun but used in Bean packages such as Bean Builder. I tried a syntax that I submit in this patch but I don't like it particularly so feel free to change for a better one if you can keep the functionality. I have added an example in the test/javabean/SimpleBean.java Since I am not familiar with XDoclet development, I send the modified files in this mail, hoping someone from the development team will take care of it. Don't hesitate to ask questions if you have any. diff -w -r -u ../xdoclet-1.2.3.orig/modules/java/src/META-INF/xtags.xml xdoclet-1.2.3/modules/java/src/META-INF/xtags.xml --- ../xdoclet-1.2.3.orig/modules/java/src/META-INF/xtags.xml 2004-08-06 21:01:00.000000000 +0200 +++ xdoclet-1.2.3/modules/java/src/META-INF/xtags.xml 2006-08-09 09:21:42.484375000 +0200 @@ -126,6 +126,7 @@ </tag> <tag> <level>class</level> + <level>method</level> <name>javabean.attribute</name> <usage-description>Defines the attributes of the JavaBean (propertyorder, etc).</usage-description> <unique>false</unique> @@ -151,6 +152,7 @@ <options> <option>true</option> <option>false</option> + <option>array</option> </options> </option-set> </option-sets> Only in xdoclet-1.2.3/modules/java/src/META-INF: xtags.xml~ diff -w -r -u ../xdoclet-1.2.3.orig/modules/java/src/xdoclet/modules/java/javabean/resources/beaninfo.xdt xdoclet-1.2.3/modules/java/src/xdoclet/modules/java/javabean/resources/beaninfo.xdt --- ../xdoclet-1.2.3.orig/modules/java/src/xdoclet/modules/java/javabean/resources/beaninfo.xdt 2004-08-06 08:42:00.000000000 +0200 +++ xdoclet-1.2.3/modules/java/src/xdoclet/modules/java/javabean/resources/beaninfo.xdt 2006-08-09 08:55:54.453125000 +0200 @@ -192,7 +192,6 @@ return null; } - /** * Gets the Property Descriptors * @@ -249,6 +248,20 @@ <XDtMethod:ifHasMethodTag tagName="javabean.property" paramName="propertyEditor" superclasses="false"> descriptor.setPropertyEditorClass(Class.forName("<XDtMethod:methodTagValue tagName="javabean.property" paramName="propertyEditor"/>")); </XDtMethod:ifHasMethodTag> + <XDtMethod:forAllMethodTags tagName="javabean.attribute"> + <XDtMethod:ifMethodTagValueEquals tagName="javabean.attribute" paramName="rtexpr" superclasses="false" value="true"> + descriptor.setValue("<XDtMethod:methodTagValue tagName="javabean.attribute" paramName="name"/>",<XDtMethod:methodTagValue tagName="javabean.attribute" paramName="value"/>); + </XDtMethod:ifMethodTagValueEquals> + <XDtMethod:ifMethodTagValueEquals tagName="javabean.attribute" paramName="rtexpr" superclasses="false" value="array"> + { + Object[] obj = { <XDtMethod:methodTagValue tagName="javabean.attribute" paramName="value"/> }; + descriptor.setValue("<XDtMethod:methodTagValue tagName="javabean.attribute" paramName="name"/>",obj); + } + </XDtMethod:ifMethodTagValueEquals> + <XDtMethod:ifMethodTagValueEquals tagName="javabean.attribute" paramName="rtexpr" superclasses="false" value="false"> + descriptor.setValue("<XDtMethod:methodTagValue tagName="javabean.attribute" paramName="name"/>","<XDtMethod:methodTagValue tagName="javabean.attribute" paramName="value"/>"); + </XDtMethod:ifMethodTagValueEquals> + </XDtMethod:forAllMethodTags> descriptors.add(descriptor); } catch (Exception ex) Only in xdoclet-1.2.3/modules/java/src/xdoclet/modules/java/javabean/resources: beaninfo.xdt~ diff -w -r -u ../xdoclet-1.2.3.orig/samples/src/java/test/javabean/SimpleBean.java xdoclet-1.2.3/samples/src/java/test/javabean/SimpleBean.java --- ../xdoclet-1.2.3.orig/samples/src/java/test/javabean/SimpleBean.java 2002-10-14 13:55:00.000000000 +0200 +++ xdoclet-1.2.3/samples/src/java/test/javabean/SimpleBean.java 2006-08-09 09:38:08.140625000 +0200 @@ -29,6 +29,14 @@ protected String name = ""; /** A Class field. */ protected Class parent = null; + /** An enum value. */ + protected int color = WHITE; + /** The WHITE value. */ + public static final int WHITE = 0; + /** The GRAY value. */ + public static final int GRAY = 1; + /** The BLACK value. */ + public static final int BLACK = 2; /** Constructs a new SimpleBean. */ public SimpleBean() { @@ -104,4 +112,24 @@ public Class getParent() { return parent; } + + /** + * @javabean.property + * displayName="Color" + * shortDescription="Color assigned to this object" + * + * @javabean.attribute + * name="enumerationValues" + * value=" \"WHITE\", 0, null, + * \"GRAY\", 1, null, + * \"BLACK\", 2, null " + * rtexpr="array" + */ + public void setColor(int color) { + this.color = color; + } + + public int getColor() { + return color; + } } \ No newline at end of file -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel