168 lines
7.3 KiB
Diff
168 lines
7.3 KiB
Diff
--- build/src/org/jibx/custom/classes/ClassItemSourceWrapper.java
|
|
+++ build/src/org/jibx/custom/classes/ClassItemSourceWrapper.java
|
|
@@ -21,6 +21,8 @@
|
|
|
|
package org.jibx.custom.classes;
|
|
|
|
+import java.util.List;
|
|
+
|
|
import org.jibx.binding.classes.ClassItem;
|
|
import org.jibx.binding.model.ClassItemWrapper;
|
|
import org.jibx.util.IClass;
|
|
@@ -29,10 +31,10 @@ import org.jibx.util.IClassLocator;
|
|
import com.thoughtworks.qdox.model.DocletTag;
|
|
import com.thoughtworks.qdox.model.JavaClass;
|
|
import com.thoughtworks.qdox.model.JavaField;
|
|
+import com.thoughtworks.qdox.model.JavaMember;
|
|
import com.thoughtworks.qdox.model.JavaMethod;
|
|
import com.thoughtworks.qdox.model.JavaParameter;
|
|
-import com.thoughtworks.qdox.model.Member;
|
|
-import com.thoughtworks.qdox.model.Type;
|
|
+import com.thoughtworks.qdox.model.JavaType;
|
|
|
|
/**
|
|
* Wrapper for class field or method item with added source information. This wraps the basic class handling
|
|
@@ -44,7 +46,7 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
{
|
|
private boolean m_checkedSource;
|
|
|
|
- private Member m_itemSource;
|
|
+ private JavaMember m_itemSource;
|
|
|
|
/**
|
|
* Constructor
|
|
@@ -64,14 +66,16 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
*/
|
|
private boolean matchSignature(JavaMethod method) {
|
|
boolean match = true;
|
|
- JavaParameter[] parms = method.getParameters();
|
|
- if (parms.length == getArgumentCount()) {
|
|
- for (int j = 0; j < parms.length; j++) {
|
|
- Type ptype = parms[j].getType();
|
|
+ List<JavaParameter> parms = method.getParameters();
|
|
+ if (parms.size() == getArgumentCount()) {
|
|
+ for (int j = 0; j < parms.size(); j++) {
|
|
+ JavaType ptype = parms.get(j).getType();
|
|
String type = ptype.getValue();
|
|
- int ndim = ptype.getDimensions();
|
|
- while (ndim-- > 0) {
|
|
- type += "[]";
|
|
+ if (ptype instanceof JavaClass) {
|
|
+ int ndim = ((JavaClass)ptype).getDimensions();
|
|
+ while (ndim-- > 0) {
|
|
+ type += "[]";
|
|
+ }
|
|
}
|
|
String comp = getArgumentType(j);
|
|
if (!comp.equals(type)) {
|
|
@@ -90,7 +94,7 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
*
|
|
* @return source information
|
|
*/
|
|
- private Member getItemSource() {
|
|
+ private JavaMember getItemSource() {
|
|
if (!m_checkedSource) {
|
|
m_checkedSource = true;
|
|
IClass clas = getContainingClass();
|
|
@@ -101,9 +105,9 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
if (jc != null) {
|
|
if (isMethod()) {
|
|
String mname = getName();
|
|
- JavaMethod[] methods = jc.getMethods();
|
|
- for (int i = 0; i < methods.length; i++) {
|
|
- JavaMethod method = methods[i];
|
|
+ List<JavaMethod> methods = jc.getMethods();
|
|
+ for (int i = 0; i < methods.size(); i++) {
|
|
+ JavaMethod method = methods.get(i);
|
|
if (mname.equals(method.getName())) {
|
|
if (matchSignature(method)) {
|
|
m_itemSource = method;
|
|
@@ -142,7 +146,7 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
* @see org.jibx.binding.model.IClassItem#getJavaDoc()
|
|
*/
|
|
public String getJavaDoc() {
|
|
- Member src = getItemSource();
|
|
+ JavaMember src = getItemSource();
|
|
if (src == null) {
|
|
return null;
|
|
} else if (isMethod()) {
|
|
@@ -181,12 +185,12 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
if (isMethod()) {
|
|
JavaMethod jm = (JavaMethod)getItemSource();
|
|
if (jm != null) {
|
|
- String name = jm.getParameters()[index].getName();
|
|
- DocletTag[] tags = jm.getTagsByName("param");
|
|
- for (int i = 0; i < tags.length; i++) {
|
|
- DocletTag tag = tags[i];
|
|
- String[] parms = tag.getParameters();
|
|
- if (parms != null && parms.length > 0 && name.equals(parms[0])) {
|
|
+ String name = jm.getParameters().get(index).getName();
|
|
+ List<DocletTag> tags = jm.getTagsByName("param");
|
|
+ for (int i = 0; i < tags.size(); i++) {
|
|
+ DocletTag tag = tags.get(i);
|
|
+ List<String> parms = tag.getParameters();
|
|
+ if (parms != null && parms.size() > 0 && name.equals(parms.get(0))) {
|
|
String text = tag.getValue().trim();
|
|
if (text.startsWith(name)) {
|
|
text = text.substring(name.length()).trim();
|
|
@@ -210,8 +214,8 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
JavaMethod jm = (JavaMethod)getItemSource();
|
|
String name;
|
|
if (jm != null) {
|
|
- JavaParameter[] parameters = jm.getParameters();
|
|
- name = parameters[index].getName();
|
|
+ List<JavaParameter> parameters = jm.getParameters();
|
|
+ name = parameters.get(index).getName();
|
|
} else {
|
|
name = super.getParameterName(index);
|
|
}
|
|
@@ -228,11 +232,11 @@ public class ClassItemSourceWrapper extends ClassItemWrapper
|
|
JavaMethod jm = (JavaMethod)getItemSource();
|
|
if (jm != null) {
|
|
String name = getExceptions()[index];
|
|
- DocletTag[] tags = jm.getTagsByName("throws");
|
|
- for (int i = 0; i < tags.length; i++) {
|
|
- DocletTag tag = tags[i];
|
|
- String[] parms = tag.getParameters();
|
|
- if (parms != null && parms.length > 0 && name.equals(parms[0])) {
|
|
+ List<DocletTag> tags = jm.getTagsByName("throws");
|
|
+ for (int i = 0; i < tags.size(); i++) {
|
|
+ DocletTag tag = tags.get(i);
|
|
+ List<String> parms = tag.getParameters();
|
|
+ if (parms != null && parms.size() > 0 && name.equals(parms.get(0))) {
|
|
return docText(tag.getValue());
|
|
}
|
|
}
|
|
--- build/src/org/jibx/custom/classes/ClassSourceLocator.java
|
|
+++ build/src/org/jibx/custom/classes/ClassSourceLocator.java
|
|
@@ -31,7 +31,7 @@ import org.jibx.binding.classes.ClassFile;
|
|
import org.jibx.runtime.JiBXException;
|
|
import org.jibx.util.IClass;
|
|
|
|
-import com.thoughtworks.qdox.JavaDocBuilder;
|
|
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
|
import com.thoughtworks.qdox.model.JavaClass;
|
|
|
|
/**
|
|
@@ -45,7 +45,7 @@ public class ClassSourceLocator implements IClassSourceLocator
|
|
private final String[] m_sourcePaths;
|
|
|
|
/** Source file parser. */
|
|
- private final JavaDocBuilder m_builder;
|
|
+ private final JavaProjectBuilder m_builder;
|
|
|
|
/** Set of classes parsed. */
|
|
private final Set m_lookupSet;
|
|
@@ -57,7 +57,7 @@ public class ClassSourceLocator implements IClassSourceLocator
|
|
*/
|
|
public ClassSourceLocator(String[] paths) {
|
|
m_sourcePaths = paths;
|
|
- m_builder = new JavaDocBuilder();
|
|
+ m_builder = new JavaProjectBuilder();
|
|
m_lookupSet = new HashSet();
|
|
}
|
|
|
|
--
|
|
2.1.0
|
|
|