Update of
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30108/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags
Modified Files:
QTagUtils.java
Log Message:
Support to QTags to return array types:
Tag values will be running through a StringTokenizer.
Each array value will be validated through if used it @qtags.allowed-value.
The StringTokenizer delimiter is by default "," but can also be ";" - This can
be set using @qtags.list-token.
Note: Before @qtags.default was not being verified against a valid value set by
@qtags.allowed-value.
Current generated tag impl changed this - The default value is set before
values validation.
Index: QTagUtils.java
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags/QTagUtils.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** QTagUtils.java 31 May 2005 11:28:56 -0000 1.11
--- QTagUtils.java 21 Aug 2005 13:44:29 -0000 1.12
***************
*** 1,4 ****
/*
! * Copyright (c) 2003
* XDoclet Team
* All rights reserved.
--- 1,4 ----
/*
! * Copyright (c) 2005
* XDoclet Team
* All rights reserved.
***************
*** 8,11 ****
--- 8,19 ----
import java.lang.reflect.InvocationTargetException;
+ import java.util.Arrays;
+ import java.util.Collection;
+ import java.util.HashMap;
+ import java.util.Map;
+
+ import org.apache.commons.collections.CollectionUtils;
+ import org.apache.commons.collections.Predicate;
+
import org.generama.MetadataProvider;
import org.generama.QDoxCapableMetadataProvider;
***************
*** 14,24 ****
--- 22,50 ----
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
+ import com.thoughtworks.qdox.model.Type;
/**
* @author Aslak Hellesøy
* @author Konstantin Pribluda
+ * @author Diogo Quintela
* @version $Revision$
*/
public class QTagUtils {
+ protected static Map acceptedTypes;
+ protected static Map tokensByName;
+
+ static {
+ acceptedTypes = new HashMap();
+ acceptedTypes.put("java.lang.Boolean", "java.lang.Boolean");
+ acceptedTypes.put("boolean", "boolean");
+ acceptedTypes.put("java.lang.Integer", "java.lang.Integer");
+ acceptedTypes.put("int", "int");
+ acceptedTypes.put("java.lang.String", "java.lang.String");
+ tokensByName = new HashMap();
+ tokensByName.put("", ",");
+ tokensByName.put("comma", ",");
+ tokensByName.put("semicolon", ";");
+ }
+
public String getDocletTagName(JavaClass clazz) {
String name = clazz.getName();
***************
*** 135,137 ****
--- 161,199 ----
return hyphenated;
}
+
+ public String getTokenizer(JavaMethod method) {
+ String retVal = null;
+ DocletTag tokenTag = method.getTagByName("qtags.list-token");
+
+ if ((tokenTag != null) && (tokenTag.getValue() != null)) {
+ retVal = (String) tokensByName.get(tokenTag.getValue());
+ }
+
+ if (retVal == null) {
+ retVal = (String) tokensByName.get("");
+ }
+
+ return retVal;
+ }
+
+ public Collection getMethods(final JavaClass javaClass) {
+ return
CollectionUtils.select(Arrays.asList(javaClass.getMethods(true)),
+ new Predicate() {
+ public boolean evaluate(Object object) {
+ JavaMethod method = (JavaMethod) object;
+ Type returnType = method.getReturns();
+ boolean retVal = true;
+ String parent =
method.getParentClass().getFullyQualifiedName();
+ retVal &= method.isPropertyAccessor();
+ retVal &= !(parent.equals(Object.class.getName()));
+ retVal &= !(parent.equals(DocletTag.class.getName()));
+ retVal &=
acceptedTypes.containsKey(returnType.getValue());
+ // Let's check the dimensions
+ // zero or one dimension is allowed
+ retVal &= returnType.getDimensions() <= 1;
+
+ return retVal;
+ }
+ });
+ }
}
\ No newline at end of file
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
xdoclet-plugins-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits