當前位置: 首頁>>代碼示例>>Java>>正文


Java MethodDoc類代碼示例

本文整理匯總了Java中com.sun.javadoc.MethodDoc的典型用法代碼示例。如果您正苦於以下問題:Java MethodDoc類的具體用法?Java MethodDoc怎麽用?Java MethodDoc使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MethodDoc類屬於com.sun.javadoc包,在下文中一共展示了MethodDoc類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: searchInSuperclass

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
private static MethodDoc searchInSuperclass(
        CompilationInfo javac, TypeElement class2query, TypeElement overriderClass,
        ExecutableElement overrider, Set<TypeElement> exclude) {
    
    // Step 3a
    TypeMirror superclassMirror = class2query.getSuperclass();
    if (superclassMirror.getKind() != TypeKind.DECLARED) {
        return null;
    }
    TypeElement superclass = (TypeElement) ((DeclaredType) superclassMirror).asElement();
    // check methods
    MethodDoc jdoc = searchInMethods(javac, superclass, overriderClass, overrider);
    if (jdoc != null) {
        return jdoc;
    }
    
    // Step 3b
    return searchInInterfaces(javac, superclass, overriderClass, overrider, exclude);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:JavadocUtilities.java

示例2: PSItemDoc

import com.sun.javadoc.MethodDoc; //導入依賴的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);
    }
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:21,代碼來源:PSItemDoc.java

示例3: getTagletOutput

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * @see com.sun.tools.doclets.internal.toolkit.taglets.Taglet#getTagletOutput(com.sun.javadoc.Doc, com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter)
 */
@Override
public TagletOutput getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException {
	Tag[] tags = doc.tags(getName());
	if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible
		final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this));
		tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
	}
	if (tags.length==0)
		return null;
	final StringBuilder out = writeHeader(new StringBuilder());
	for(Tag tag : tags) { 
		writeTag(out, tag, writer);
	}
	return new TagletOutputImpl(out.toString());
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:20,代碼來源:SpecificationTaglet.java

示例4: processOpenAPIClasses

import com.sun.javadoc.MethodDoc; //導入依賴的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);
			}
		}
	}
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:24,代碼來源:AbstractServiceDocBuilder.java

示例5: processServiceClass

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
protected void processServiceClass(ClassDoc service,
		Configuration configuration) {
	Tag[] serviceTagArray = service.tags(WRTagTaglet.NAME);
	for (int i = 0; i < serviceTagArray.length; i++) {
		Set<String> serviceTags = WRTagTaglet.getTagSet(serviceTagArray[i]
				.text());
		for (Iterator<String> iter = serviceTags.iterator(); iter.hasNext();) {
			String tag = iter.next();
			if (!this.taggedOpenAPIMethods.containsKey(tag)) {
				this.taggedOpenAPIMethods
						.put(tag, new HashSet<MethodDoc>());
			}
			// all method of this service should be processed later.
			for (int j = 0; j < service.methods().length; j++) {
				if (configuration.nodeprecated
						&& Util.isDeprecated(service.methods()[j])) {
					continue;
				}
				this.taggedOpenAPIMethods.get(tag)
						.add(service.methods()[j]);
			}
		}

		this.wrDoc.getWRTags().addAll(serviceTags);
	}
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:27,代碼來源:AbstractServiceDocBuilder.java

示例6: processAnnotationDubboInterfaces

import com.sun.javadoc.MethodDoc; //導入依賴的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;
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:27,代碼來源:DubboDocBuilder.java

示例7: getOutputParam

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
@Override
protected APIParameter getOutputParam(MethodDoc methodDoc) {
	APIParameter apiParameter = null;
	if (methodDoc.returnType() != null) {
		apiParameter = new APIParameter();
		apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
		apiParameter.setType(this.getTypeName(methodDoc.returnType(), false));
		for (Tag tag : methodDoc.tags("return")) {
			apiParameter.setDescription(tag.text());
		}
		HashSet<String> processingClasses = new HashSet<String>();
		apiParameter.setFields(this.getFields(methodDoc.returnType(),
				ParameterType.Response, processingClasses));
		apiParameter.setHistory(this.getModificationHistory(methodDoc
				.returnType()));
	}
	return apiParameter;
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:19,代碼來源:DubboDocBuilder.java

示例8: parseRequestMapping

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
@Override
protected RequestMapping parseRequestMapping(MethodDoc method) {
	RequestMapping mapping = new RequestMapping();
	mapping.setContainerName(method.containingClass().simpleTypeName());
	AnnotationDesc[] annotations = method.annotations();
	String url = method.toString().replaceFirst(
			method.containingClass().qualifiedName() + ".", "");
	for (int i = 0; i < annotations.length; i++) {
		if (annotations[i].annotationType().name().equals("WebMethod")) {
			for (ElementValuePair p : annotations[i].elementValues()) {
				if (p.element().name().equals("operationName")) {
					url = url.replace(method.name(), p.value().value()
							.toString().replace("\"", ""));
				}
			}
		}
	}
	mapping.setUrl(url);
	mapping.setTooltip(method.containingClass().simpleTypeName());
	mapping.setContainerName(method.containingClass().simpleTypeName());
	return mapping;
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:23,代碼來源:SOAPDocBuilder.java

示例9: writeMethodFieldInitializers

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:29,代碼來源:StubSkeletonWriter.java

示例10: getTestMethods

import com.sun.javadoc.MethodDoc; //導入依賴的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]);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:22,代碼來源:UnitTestDoclet.java

示例11: foundMethod

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
private boolean foundMethod(ClassDoc clazz, boolean include,
        String methodName, int parameterCount) {
    if (include) {
        for (MethodDoc m : clazz.methods()) {
            if (m.name().equals(methodName)
                    && m.parameters().length == parameterCount) {
                return true;
            }
        }
    }
    for (ClassDoc doc : clazz.interfaces()) {
        if (foundMethod(doc, true, methodName, parameterCount)) {
            return true;
        }
    }
    clazz = clazz.superclass();
    return clazz != null
            && foundMethod(clazz, true, methodName, parameterCount);
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:20,代碼來源:Doclet.java

示例12: start

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
public static boolean start(RootDoc doc) throws FileNotFoundException, IOException {
    if(out == null) out = System.out;
    for (ClassDoc cls : doc.classes()) {
        Map<String, MethodDoc> allProps = getPropNames(cls);
        for (MethodDoc m : cls.methods()) {
            String propName = getPropName(m, true);
            if (propName != null) {
                MethodDoc mDeclaring = allProps.get(propName);
                if (mDeclaring != null) {
                    boolean supported = false;
                    if (m.name().startsWith("get") || m.name().startsWith("is")) {
                        supported = m.returnType().equals(mDeclaring.returnType());
                    } else if (m.name().startsWith("set")) {
                        supported = m.parameters()[0].type().equals(mDeclaring.returnType());
                    }
                    if (supported) {
                        out.println(cls.qualifiedName() + "." + propName);
                    }
                }
            }
        }
    }
    return true;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:25,代碼來源:Template.java

示例13: getPropName

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
protected static String getPropName(MethodDoc m, boolean includeSetters) {
    if (m.parameters().length > 0) {
        return null;
    }
    if (m.name().startsWith("get") && m.name().length() > 3) {
        if (m.returnType().typeName().equals(Void.TYPE.getName())) {
            return null;
        }
        return m.name().substring(3, 4).toLowerCase() + m.name().substring(4);
    }
    if (m.name().startsWith("is") && m.name().length() > 2) {
        if (m.returnType().typeName().equals(Boolean.TYPE.getName())) {
            return null;
        }
        return m.name().substring(2, 3).toLowerCase() + m.name().substring(3);
    }
    if (includeSetters && m.name().startsWith("set") && m.name().length() > 3) {
        if (!m.returnType().typeName().equals(Void.TYPE.getName())
                || m.parameters().length != 1) {
            return null;
        }
        return m.name().substring(3, 4).toLowerCase() + m.name().substring(4);
    }
    return null;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:26,代碼來源:Template.java

示例14: getTagletOutput

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Content getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException {
	Tag[] tags = doc.tags(getName());
	if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible
		final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this));
		tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
	}
	if (tags.length==0)
		return null;
	final StringBuilder out = writeHeader(new StringBuilder());
	for(Tag tag : tags) { 
		writeTag(out, tag, writer);
	}
	return new RawHtml(out.toString());
}
 
開發者ID:emina,項目名稱:kodkod,代碼行數:19,代碼來源:SpecificationTaglet.java

示例15: parseIdentifier

import com.sun.javadoc.MethodDoc; //導入依賴的package包/類
private String parseIdentifier(Doc doc) {
  if (doc instanceof ClassDoc) {
    ClassDoc classDoc = (ClassDoc) doc;

    return parseIdentifier((Doc) classDoc.containingPackage()) + classDoc.name() + "/";
  } else if (doc instanceof AnnotationTypeElementDoc) {
    AnnotationTypeElementDoc annotationTypeElementDoc = (AnnotationTypeElementDoc) doc;
    return parseIdentifier((Doc) annotationTypeElementDoc.containingClass()) + "#" + annotationTypeElementDoc.name();
  } else if (doc instanceof FieldDoc) {
    FieldDoc fieldDoc = (FieldDoc) doc;
    return parseIdentifier((Doc) fieldDoc.containingClass()) + "#" + fieldDoc.name();
  } else if (doc instanceof ConstructorDoc) {
    ConstructorDoc constructorDoc = (ConstructorDoc) doc;
    return parseIdentifier((Doc) constructorDoc.containingClass()) + "#" + constructorDoc.name() + URLEncoder.encode(constructorDoc.flatSignature());
  } else if (doc instanceof MethodDoc) {
    MethodDoc methodDoc = (MethodDoc) doc;
    return parseIdentifier((Doc) methodDoc.containingClass()) + "#" + methodDoc.name() + URLEncoder.encode(methodDoc.flatSignature());
  } else {
    return "/" + doc.name() + "/";
  }
}
 
開發者ID:riptano,項目名稱:xml-doclet,代碼行數:22,代碼來源:Parser.java


注:本文中的com.sun.javadoc.MethodDoc類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。