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


Java MethodDoc.name方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: printMethodsSummary

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Prints summary of Test API methods, excluding old-style verbs, in HTML format.
 *
 * @param classDoc the classDoc of the Test API component
 */
public void printMethodsSummary(ClassDoc classDoc) {
    MethodDoc[] methodDocs = TestAPIDoclet.getTestAPIComponentMethods(classDoc);
    if (methodDocs.length > 0) {
        mOut.println("<P>");
        mOut.println("<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" CELLSPACING=\"0\" SUMMARY=\"\">");
        mOut.println("<TR BGCOLOR=\"#CCCCFF\"><TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\"><B>Methods "
              + "Summary</B></FONT></TH></TR>");
        for (MethodDoc methodDoc : methodDocs) {
            String methodName = methodDoc.name();
            mOut.print(
                  "<TR><TD WIDTH=\"1%\"><CODE><B><A HREF=\"#" + methodName + methodDoc.flatSignature() + "\">" + methodName
                        + "</A></B></CODE></TD><TD>");
            Tag[] firstSentenceTags = methodDoc.firstSentenceTags();
            if (firstSentenceTags.length == 0) {
                System.err.println("Warning: method " + methodName + " of " + methodDoc.containingClass().simpleTypeName()
                      + " has no description");
            }
            printInlineTags(firstSentenceTags, classDoc);
            mOut.println("</TD>");
        }

        mOut.println("</TABLE>");
    }
}
 
開發者ID:qspin,項目名稱:qtaste,代碼行數:30,代碼來源:HTMLFileWriter.java

示例4: getNameTypeDescriptionList

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Gets the list of name,type and description parsed from an array of tags using the pattern
 * NAME_TYPE_DESCRIPTION_PATTERN. For non-matching tags, name is set to tag text, and type and description
 * are set to "INVALID_FORMAT".
 *
 * @param tags array of Tag
 * @return List of NameTypeDescription
 */
public static List<NameTypeDescription> getNameTypeDescriptionList(Tag[] tags) {
    List<NameTypeDescription> nameTypeDescriptionList = new ArrayList<>();

    for (Tag tag : tags) {
        String text = tag.text().trim();
        Matcher matcher = NAME_TYPE_DESCRIPTION_PATTERN.matcher(text);
        if (matcher.matches()) {
            nameTypeDescriptionList.add(new NameTypeDescription(matcher.group(1), matcher.group(2), matcher.group(3)));
        } else {
            String error = "Invalid " + tag.name() + " tag format \"" + text + "\" for ";
            if (tag.holder() instanceof MethodDoc) {
                MethodDoc methodDoc = (MethodDoc) tag.holder();
                error += "verb " + methodDoc.name() + " of component " + methodDoc.containingClass().simpleTypeName();
            } else if (tag.holder() instanceof ClassDoc) {
                ClassDoc classDoc = (ClassDoc) tag.holder();
                error += "component " + classDoc.simpleTypeName();
            } else {
                error += "unknown Doc type";
            }
            System.err.println(error);
            nameTypeDescriptionList.add(new NameTypeDescription(text, "INVALID_FORMAT", "INVALID_FORMAT"));
        }
    }
    return nameTypeDescriptionList;
}
 
開發者ID:qspin,項目名稱:qtaste,代碼行數:34,代碼來源:TestAPIDoclet.java

示例5: PSOperatorDoc

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

示例6: getFriendlyUnqualifiedSignature

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Returns a reader-friendly string representation of the
 * specified method's signature.  Names of reference types are not
 * package-qualified.
 **/
static String getFriendlyUnqualifiedSignature(MethodDoc method) {
    String sig = method.name() + "(";
    Parameter[] parameters = method.parameters();
    for (int i = 0; i < parameters.length; i++) {
        if (i > 0) {
            sig += ", ";
        }
        Type paramType = parameters[i].type();
        sig += paramType.typeName() + paramType.dimension();
    }
    sig += ")";
    return sig;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:Util.java

示例7: findImplMethod

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Returns the MethodDoc for the method of this remote
 * implementation class that implements the specified remote
 * method of a remote interface.  Returns null if no matching
 * method was found in this remote implementation class.
 **/
private MethodDoc findImplMethod(MethodDoc interfaceMethod) {
    String name = interfaceMethod.name();
    String desc = Util.methodDescriptorOf(interfaceMethod);
    for (MethodDoc implMethod : implClass.methods()) {
        if (name.equals(implMethod.name()) &&
            desc.equals(Util.methodDescriptorOf(implMethod)))
        {
            return implMethod;
        }
    }
    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:RemoteClass.java

示例8: Method

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Creates a new Method instance for the specified method.
 **/
Method(MethodDoc methodDoc) {
    this.methodDoc = methodDoc;
    exceptionTypes = methodDoc.thrownExceptions();
    /*
     * Sort exception types to improve consistency with
     * previous implementations.
     */
    Arrays.sort(exceptionTypes, new ClassDocComparator());
    operationString = computeOperationString();
    nameAndDescriptor =
        methodDoc.name() + Util.methodDescriptorOf(methodDoc);
    methodHash = computeMethodHash();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:RemoteClass.java

示例9: getExportedName

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
private String getExportedName(MethodDoc cd) {
  String ename = cd.name();
  for (AnnotationDesc a : cd.annotations()) {
    if (a.annotationType().name().equals("Export")) {
      for (AnnotationDesc.ElementValuePair p : a.elementValues()) {
        ename = p.value().toString();
        break;
      }
    }
  }
  return ename.replaceAll("\"", "");
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:13,代碼來源:ChronoscopeDoclet.java

示例10: getUniqueFullInfo

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
 * Method to count the unique identifier (through all .html document), that
 * represents the concrete method, this identifier however contains also
 * characters like dot or hash, which can not be used as a variable (see
 * getUniqueInfo)
 *
 * @param doc the methodDoc of method, for which the unique ID will be
 * counted
 * @return the unique info (packageName#className#method#Params#Number)
 */
public static String getUniqueFullInfo(MethodDoc doc) {
    String containingPackage = doc.containingPackage().name();
    String className = doc.containingClass().name();
    String methodName = doc.name();
    String abbrParams = getAbbrParams(doc);

    String fullMethodName = (containingPackage + "#" + className + "#" + methodName);
    String number = GeneratorBase.getNewGeneratorID(fullMethodName) + "";

    return (fullMethodName + "#" + abbrParams + "#" + number);
}
 
開發者ID:arahusky,項目名稱:performance_javadoc,代碼行數:22,代碼來源:PerformanceNamingUtils.java

示例11: makeMethodInfo

import com.sun.javadoc.MethodDoc; //導入方法依賴的package包/類
/**
	 * Convert a javadoc method object into my MethodInfo object.
	 * This function also creates Serializable classes to transmit the parameters and return value.
	 * @param errInfo
	 * @param remoteName
	 * @param remoteQName
	 * @param method
	 * @return Object
	 * @throws GeneratorException
	 */
	private MethodInfo makeMethodInfo(ErrorInfo errInfo, String remoteName, String remoteQName, MethodDoc method) throws GeneratorException {
		errInfo = errInfo.copy();
		ArrayList<CommentInfo> cinfos = new ArrayList<CommentInfo>();
		addSummaryAndRemarksCommentInfo(method, cinfos);
		
		String name = errInfo.methodName = method.name();
    if (FORBIDDEN_FIELD_AND_METHOD_NAMES.contains(name)) {
      errInfo.fieldName = name;
      errInfo.msg = "Forbidden method name";
      throw new GeneratorException(errInfo);
    }

		long since = getSince(errInfo, method.tags());
		
		SerialInfo requestInfo = makeMethodRequest(errInfo, remoteName, remoteQName, method);

		SerialInfo resultInfo = makeMethodResult(errInfo, remoteName, remoteQName, method);
				
		boolean foundBException = false;
		ArrayList<TypeInfo> exceptions = new ArrayList<TypeInfo>();
		
		for (Type ex : method.thrownExceptionTypes()) {
			if (ex.simpleTypeName().equals(RemoteException.class.getSimpleName())) {
				foundBException = true; 
				continue;
			}
			
			// Currently, I don't know how to deal with custom exception classes in C++
			errInfo.msg = "Custom exception classes are unsupported. Methods must throw byps.RemoteException.";
			throw new GeneratorException(errInfo);

//			if (!isSerializable(ex.asClassDoc())) {
//				throw new GeneratorException("Custom exception class \"" + ex.toString() + "\" must implement BSerializable.");
//			}
//			
//			TypeInfo exInfo = makeElementTypeInfo(ex, remoteQName);
//			exceptions.add( exInfo );
		}
		
		if (!foundBException) {
			errInfo.msg = "Method must throw byps.RemoteException";
			throw new GeneratorException(errInfo);
		}
		
		MethodInfo minfo = new MethodInfo(
				method.name(), cinfos, 
				requestInfo, resultInfo, 
				exceptions, since); 
		
		return minfo;
	}
 
開發者ID:wolfgangimig,項目名稱:byps,代碼行數:62,代碼來源:BConvert.java


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