本文整理匯總了Java中com.sun.javadoc.ClassDoc類的典型用法代碼示例。如果您正苦於以下問題:Java ClassDoc類的具體用法?Java ClassDoc怎麽用?Java ClassDoc使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ClassDoc類屬於com.sun.javadoc包,在下文中一共展示了ClassDoc類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PSItemDoc
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
private PSItemDoc(ClassDoc classDoc) {
this.classDoc = classDoc;
this.name = classDoc.name();
this.description = classDoc.commentText();
this.itemFieldDocs = new ArrayList<>();
this.providerDocs = new ArrayList<>();
List<FieldDoc> allFields = new ArrayList<>();
this.getAllFieldDocs(classDoc, allFields);
for (FieldDoc fieldDoc : allFields) {
PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc);
if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc);
}
for (MethodDoc methodDoc : classDoc.methods()) {
PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc);
if (providerDoc != null) this.providerDocs.add(providerDoc);
}
}
示例2: getInputParams
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
@Override
protected APIParameter getInputParams(ClassDoc classDoc) {
if(classDoc.tags(WRMqConsumerTaglet.NAME).length > 0) {
APIParameter apiParameter = new APIParameter();
apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
apiParameter.setType(classDoc.qualifiedTypeName());
apiParameter.setName(classDoc.name());
HashSet<String> processingClasses = new HashSet<String>();
apiParameter.setFields(this.getFields(classDoc,
ParameterType.Request, processingClasses));
apiParameter.setDescription(classDoc.commentText());
return apiParameter;
} else {
return null;
}
}
示例3: processOpenAPIClasses
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
@Override
protected void processOpenAPIClasses(ClassDoc[] classes,
Configuration configuration) {
for (int i = 0; i < classes.length; i++) {
if (configuration.nodeprecated
&& (Util.isDeprecated(classes[i]) || Util
.isDeprecated(classes[i].containingPackage()))) {
continue;
}
if (this.isServiceInterface(classes[i])) {
this.processServiceClass(classes[i], configuration);
MethodDoc[] methods = classes[i].methods();
for (int l = 0; l < methods.length; l++) {
if (configuration.nodeprecated
&& Util.isDeprecated(methods[l])) {
continue;
}
this.processOpenAPIMethod(methods[l], configuration);
}
}
}
}
示例4: isInStopClasses
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
protected boolean isInStopClasses(ClassDoc classDoc) {
String property = ApplicationContextConfig.getStopClasses();
if (property != null) {
String[] stopClasses = property.split(",");
String[] cdParts = classDoc.qualifiedTypeName().split("\\.");
for (String stopClass : stopClasses) {
String[] scParts = stopClass.trim().split("\\.");
if (scParts.length <= cdParts.length) {
boolean hasDiffPart = false;
for (int i = 0; i < scParts.length; i++) {
if (scParts[i].equals("*")) {
return true;
} else if (!scParts[i].equalsIgnoreCase(cdParts[i])) {
hasDiffPart = true;
break;
}
}
if (scParts.length == cdParts.length && !hasDiffPart) {
return true;
}
}
}
}
return false;
}
示例5: processAnnotationDubboInterfaces
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
protected LinkedList<String> processAnnotationDubboInterfaces(ClassDoc[] classes) {
LinkedList<String> result = new LinkedList<String>();
for (int i = 0; i < classes.length; i++) {
// implementation class which used com.alibaba.dubbo.config.annotation.Service
if(isDubboService(classes[i])) {
for(ClassDoc interfaceClassDoc : classes[i].interfaces()) {
result.add(interfaceClassDoc.qualifiedName());
// mapping the method in interface to the method in implementation class
for(MethodDoc implMethodDoc : classes[i].methods()) {
MethodDoc overriddenMethod = implMethodDoc.overriddenMethod();
if(overriddenMethod != null) {
methodMap.put(overriddenMethod, implMethodDoc);
} else {
//It seems that MethodDoc.overriddenMethod() doesn't work, but MethodDoc.overrides() works fine.
for(MethodDoc interfaceMethodDoc : interfaceClassDoc.methods()) {
if(implMethodDoc.overrides(interfaceMethodDoc)) {
methodMap.put(interfaceMethodDoc, implMethodDoc);
}
}
}
}
}
}
}
return result;
}
示例6: isDubboService
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
protected boolean isDubboService(ClassDoc classDoc) {
AnnotationDesc[] annotations = classDoc.annotations();
for (int i = 0; i < annotations.length; i++) {
if (annotations[i].annotationType().qualifiedTypeName().equals("com.alibaba.dubbo.config.annotation.Service")) {
AnnotationDesc.ElementValuePair[] elementValuePairs = annotations[i].elementValues();
for (AnnotationDesc.ElementValuePair elementValuePair : elementValuePairs) {
if("protocol".equals(elementValuePair.element().name())
&& "http".equals(protocolMap.get(elementValuePair.value().toString().replace("\"", "")))) {
return false;
}
}
return true;
}
}
return false;
}
示例7: mergeWith
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
/**
* Returns a new Method object that is a legal combination of
* this Method object and another one.
*
* Doing this requires determining the exceptions declared by
* the combined method, which must be (only) all of the
* exceptions declared in both old Methods that may thrown in
* either of them.
**/
Method mergeWith(Method other) {
if (!nameAndDescriptor().equals(other.nameAndDescriptor())) {
throw new AssertionError(
"attempt to merge method \"" +
other.nameAndDescriptor() + "\" with \"" +
nameAndDescriptor());
}
List<ClassDoc> legalExceptions = new ArrayList<ClassDoc>();
collectCompatibleExceptions(
other.exceptionTypes, exceptionTypes, legalExceptions);
collectCompatibleExceptions(
exceptionTypes, other.exceptionTypes, legalExceptions);
Method merged = clone();
merged.exceptionTypes =
legalExceptions.toArray(new ClassDoc[legalExceptions.size()]);
return merged;
}
示例8: collectCompatibleExceptions
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
/**
* Adds to the supplied list all exceptions in the "froms"
* array that are subclasses of an exception in the "withs"
* array.
**/
private void collectCompatibleExceptions(ClassDoc[] froms,
ClassDoc[] withs,
List<ClassDoc> list)
{
for (ClassDoc from : froms) {
if (!list.contains(from)) {
for (ClassDoc with : withs) {
if (from.subclassOf(with)) {
list.add(from);
break;
}
}
}
}
}
示例9: getTestMethods
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
/**
* Returns an array containing all of the "test" methods (including those that are inherited) for
* the given class.
*/
private static MethodDoc[] getTestMethods(ClassDoc c) {
Set set = new TreeSet();
while (c != null) {
MethodDoc[] methods = c.methods();
for (int i = 0; i < methods.length; i++) {
MethodDoc method = methods[i];
if (method.isPublic() && method.parameters().length == 0
&& method.name().startsWith("test")) {
set.add(method);
}
}
c = c.superclass();
}
return (MethodDoc[]) set.toArray(new MethodDoc[0]);
}
示例10: PSOperatorDoc
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
private PSOperatorDoc(ClassDoc classDoc, MethodDoc methodDoc) {
this.declaringClassDoc = classDoc;
this.methodDoc = methodDoc;
this.description = methodDoc.commentText().replace('\n', ' ');
this.paramDesc = "";
Tag[] paramTags = methodDoc.tags("param");
for (Tag paramTag : paramTags) {
String paraStr = paramTag.text();
String paraName = paraStr.substring(0, paraStr.indexOf(' ')).replace('\n', ' ');;
String paraDesc = paraStr.substring(paraStr.indexOf(' ') + 1).replace('\n', ' ');;
this.paramDesc += "<br> - `" + paraName + "`: " + paraDesc;
}
this.returnType = methodDoc.returnType();
// ParameterizedType returnType = methodDoc.returnType().asParameterizedType();
// this.inputType = returnType.typeArguments()[0];
// this.outputType = returnType.typeArguments()[1];
// this.completeSignature = "Function<" + this.inputType + ", " + this.outputType + "> " + methodDoc.toString();
String shortSignature = classDoc.name() + "." + methodDoc.name() + "(";
boolean firstParameter = true;
for (Parameter parameter : methodDoc.parameters()) {
if (firstParameter) {
shortSignature += Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
firstParameter = false;
} else {
shortSignature += ", " + Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
}
}
shortSignature += ")";
this.shortSignature = shortSignature;
}
示例11: build
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
public static PSOperatorDoc build(ClassDoc classDoc, MethodDoc methodDoc) {
if (methodDoc.isStatic() && methodDoc.isPublic()
&& Utils.instanceOf(methodDoc.returnType().asClassDoc(), Consts.TYPE_FUNCTION)) {
return new PSOperatorDoc(classDoc, methodDoc);
}
return null;
}
示例12: build
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
public static PSOperatorWrapperDoc build(ClassDoc classDoc) {
AnnotationDesc[] annotations = classDoc.annotations();
for (AnnotationDesc annotation : annotations) {
AnnotationTypeDoc annotationType = annotation.annotationType();
if (Consts.OPERATOR_WRAPPER_ANNOTATION.equals(annotationType.toString())) {
return new PSOperatorWrapperDoc(classDoc);
}
}
return null;
}
示例13: build
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
public static PSPipelineDoc build(ClassDoc classDoc, MethodDoc methodDoc) {
AnnotationDesc[] annotations = methodDoc.annotations();
for (AnnotationDesc annotation : annotations) {
AnnotationTypeDoc annotationType = annotation.annotationType();
if (Consts.TRANSFORMATION_ANNOTATION.equals(annotationType.toString())) {
return new PSPipelineDoc(classDoc, methodDoc, annotation, TYPE_TRANSFORMATION);
}
else if (Consts.ACTION_ANNOTATION.equals(annotationType.toString())) {
return new PSPipelineDoc(classDoc, methodDoc, annotation, TYPE_ACTION);
}
}
return null;
}
示例14: build
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
private boolean build(RootDoc rootDoc) {
this.readOptions(rootDoc.options());
ClassDoc[] classes = rootDoc.classes();
for (int i = 0; i < classes.length; ++i) {
ClassDoc classDoc = classes[i];
PSItemDoc itemDoc = PSItemDoc.build(classDoc);
if (itemDoc != null) this.psItems.add(itemDoc);
PSOperatorWrapperDoc operatorWrapperDoc = PSOperatorWrapperDoc.build(classDoc);
if (operatorWrapperDoc != null) this.psOperatorWrappers.add(operatorWrapperDoc);
if (Utils.instanceOf(classDoc, Consts.TYPE_P_STREAM)) {
for (MethodDoc methodDoc : classDoc.methods()) {
PSPipelineDoc pipelineDoc = PSPipelineDoc.build(classDoc, methodDoc);
if (pipelineDoc != null) {
this.psPipelines.add(pipelineDoc);
}
}
}
}
this.dump();
return true;
}
示例15: getAllFieldDocs
import com.sun.javadoc.ClassDoc; //導入依賴的package包/類
private void getAllFieldDocs(ClassDoc classDoc, List<FieldDoc> fieldDocs) {
if (classDoc.superclass() != null) {
this.getAllFieldDocs(classDoc.superclass(), fieldDocs);
}
if (isValidPSItem(classDoc)) {
fieldDocs.addAll(Arrays.asList(classDoc.fields()));
}
}