本文整理汇总了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);
}
示例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);
}
}
示例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());
}
示例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);
}
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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("});");
}
}
示例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]);
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
示例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() + "/";
}
}