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


Java PackageDoc類代碼示例

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


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

示例1: renderPackage

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Renders a package documentation to an AsciiDoc file.
 *
 * @param doc the package documentation object
 */
private void renderPackage(PackageDoc doc){
    try {
        PrintWriter writer = getWriter(doc, "package-info");
        writer.println(doc.name());
        if (doc.position() != null) {
            outputText(doc.name(), doc.getRawCommentText(), writer);
        }
        if (doc instanceof AnnotationTypeDoc) {
            for (MemberDoc member : ((AnnotationTypeDoc) doc).elements()) {
                outputText(member.name(), member.getRawCommentText(), writer);
            }
        }
        writer.flush();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:johncarl81,項目名稱:exportdoclet,代碼行數:23,代碼來源:ExportRenderer.java

示例2: addUsedBy

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 *  @param usedClassToPackagesMap  ClassDoc to (PackageDoc to (UsageType to (Set of Doc)))
 */
private void addUsedBy(Map usedClassToPackagesMap,
                       ClassDoc usedClass, UsageType usageType, Doc user, PackageDoc userPackage)
{
   Map packageToUsageTypeMap = (Map)usedClassToPackagesMap.get(usedClass);
   if (null == packageToUsageTypeMap) {
      packageToUsageTypeMap = new HashMap();
      usedClassToPackagesMap.put(usedClass, packageToUsageTypeMap);
   }

   Map usageTypeToUsersMap = (Map)packageToUsageTypeMap.get(userPackage);
   if (null == usageTypeToUsersMap) {
      usageTypeToUsersMap = new TreeMap();
      packageToUsageTypeMap.put(userPackage, usageTypeToUsersMap);
   }

   Set userSet = (Set)usageTypeToUsersMap.get(usageType);
   if (null == userSet) {
      userSet = new TreeSet(); // FIXME: we need the collator from Main here
      usageTypeToUsersMap.put(usageType, userSet);
   }
   userSet.add(user);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:26,代碼來源:AbstractDoclet.java

示例3: toPackageNode

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Returns the XML node corresponding to the specified ClassDoc.
 *
 * @param doc The package to transform.
 */
private static XMLNode toPackageNode(PackageDoc doc) {
  XMLNode node = new XMLNode("package", doc);

  // Core attributes
  node.attribute("name", doc.name());

  // Comment
  node.child(toComment(doc));

  // Child nodes
  node.child(toAnnotationsNode(doc.annotations()));
  node.child(toStandardTags(doc));
  node.child(toTags(doc));
  node.child(toSeeNodes(doc.seeTags()));

  return node;
}
 
開發者ID:pageseeder,項目名稱:xmldoclet,代碼行數:23,代碼來源:XMLDoclet.java

示例4: getExportedPackage

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
private String getExportedPackage(ClassDoc clz) {
  if (clz == null) {
    return "";
  }

  PackageDoc cpkg = clz.containingPackage();
  String pkg = cpkg == null ? "" : (cpkg.name());

  for (AnnotationDesc a : clz.annotations()) {
    if (a.annotationType().name().equals("ExportPackage")) {
      for (AnnotationDesc.ElementValuePair p : a.elementValues()) {
        pkg = p.value().toString();
        break;
      }
    }
  }
  pkg = pkg.replaceAll("\"", "");
  return pkg;
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:20,代碼來源:ChronoscopeDoclet.java

示例5: getPackages

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
private PackageDoc[] getPackages(PackageDoc[] orig, String... types) {
    List<PackageDoc> wrapped = new ArrayList<PackageDoc>();

    for (PackageDoc p : orig) {
        // wrap the package
        ClassLoader loader = WonderlandDoclet.class.getClassLoader();
        Class<?>[] interfaces = new Class<?>[] { PackageDoc.class };
        InvocationHandler handler = new PackageDocWrapper(p, "ExperimentalAPI");
        PackageDoc pkg =
                (PackageDoc) Proxy.newProxyInstance(loader, interfaces, handler);
        if (pkg.allClasses().length > 0) {
            wrapped.add(pkg);
        }
    }
    
    return wrapped.toArray(new PackageDoc[0]);
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:18,代碼來源:WonderlandDoclet.java

示例6: classLink

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Appends to the current document a valid markdown link
 * that aims to be the shortest one, by using the
 * {@link #getPath(String, String)} method. The
 * built URL will start from the given ``source``
 * package to the given ``target`` class.
 *  
 * @param source Source package to start URL from.
 * @param target Target class to reach from this package.
 */
public void classLink(final PackageDoc source, final ClassDoc target) {
	if (target.isIncluded()) {
		final String path = getPath(source.name(), target.containingPackage().name());
		final StringBuffer urlBuilder = new StringBuffer();
		urlBuilder
			.append(path)
			.append(target.simpleTypeName())
			.append(MarkdownDocumentBuilder.LINK_EXTENSION);
		link(target.simpleTypeName(), urlBuilder.toString());
	}
	else {
		// TODO : Process external link here.
		// TODO : Use marklet-directory project when done.
		italic(target.qualifiedName());
	}
}
 
開發者ID:Faylixe,項目名稱:marklet,代碼行數:27,代碼來源:MarkletDocumentBuilder.java

示例7: parameterLinks

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Appends to the current document the list of parameters
 * from the given ``type`` if any.
 * 
 * @param source Source package to start URL from.
 * @param type Target type to append parameters from.
 */
private void parameterLinks(final PackageDoc source, final Type type) {
	final ParameterizedType invocation = type.asParameterizedType();
	if (invocation != null) {
		final Type [] types = invocation.typeArguments();
		if (types.length > 0) {
			character('<');
			for (int i = 0; i < types.length; i++) {
				parameterLink(source, types[i]);
				if (i < types.length - 1) {
					text(", ");
				}
			}
			character('>');
		}
	}
}
 
開發者ID:Faylixe,項目名稱:marklet,代碼行數:24,代碼來源:MarkletDocumentBuilder.java

示例8: parameterLink

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Appends to the current document the given type parameter
 * as a valid markdown link.
 * 
 * @param source Source package to start URL from.
 * @param type Target type parameter to reach from this package.
 */
private void parameterLink(final PackageDoc source, final Type type) {
	final WildcardType wildcard = type.asWildcardType();
	if (wildcard != null) {
		character('?');
	}
	else {
		final TypeVariable variableType = type.asTypeVariable();
		if (variableType != null) {
			final Type [] bounds = variableType.bounds();
			if (bounds.length > 0) {
				text("? extends ");
				for (int i = 0; i < bounds.length; i++) {
					typeLink(source, bounds[i]);
					if (i < bounds.length - 1) {
						text(" & ");
					}
				}
			}
		}
		else {
			typeLink(source, type);
		}
	}
}
 
開發者ID:Faylixe,項目名稱:marklet,代碼行數:32,代碼來源:MarkletDocumentBuilder.java

示例9: header

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Appends to the current document the class
 * header. Consists in the class name with a
 * level 1 header, the class hierarchy, and
 * the comment text.
 */
private void header() {
	title();
	newLine();
	newLine();

	final PackageDoc packageDoc = classDoc.containingPackage();
	final String packageName = packageDoc.name();
	item();
	text(MarkletConstant.PACKAGE);
	character(' ');
	link(packageName, MarkletConstant.README_LINK);
	newLine();
	item();
	classHierarchy();
	interfaceHierarchy();
	newLine();
	newLine();
	description(classDoc);
	newLine();
	newLine();
}
 
開發者ID:Faylixe,項目名稱:marklet,代碼行數:28,代碼來源:ClassPageBuilder.java

示例10: processPackageDoc

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * @return the full JSON for the given PackageDoc
 */
protected JSONObject processPackageDoc(PackageDoc packageDoc) {

    if (packageDoc == null) {
        return null;
    }

    JSONObject retMe = processDoc(packageDoc);

    retMe.put("annotations", processAnnotationDescs(packageDoc.annotations()));
    retMe.put("annotationTypes", processAnnotationTypeDocStubs(packageDoc.annotationTypes()));
    retMe.put("enums", processClassDocStubs(packageDoc.enums()));
    retMe.put("errors", processClassDocStubs(packageDoc.errors()));
    retMe.put("exceptions", processClassDocStubs(packageDoc.exceptions()));
    retMe.put("interfaces", processClassDocStubs(packageDoc.interfaces()));
    retMe.put("ordinaryClasses", processClassDocStubs(packageDoc.ordinaryClasses()));

    return retMe;
}
 
開發者ID:rob4lderman,項目名稱:javadoc-json-doclet,代碼行數:22,代碼來源:JsonDoclet.java

示例11: doRenderOn

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
@Override
protected void doRenderOn(HtmlCanvas html) throws IOException {
    PackagePage page = PageRenderer.getPage(html);
    PackageDoc packageDoc = page.getPackageDoc();

    html.div(class_("api_header")).p().content("package").h1().content(packageDoc.name())._div();
    if (packageDoc.inlineTags() != null && packageDoc.inlineTags().length > 0) {
        html.h2().content("Overview");
        html.p().render(new InlineTagsRenderer(generator, packageDoc.inlineTags(), packageDoc.position()))._p();
    }
    renderTypes(packageDoc.interfaces(), "Interfaces", page, html);
    renderTypes(packageDoc.ordinaryClasses(), "Classes", page, html);
    renderTypes(packageDoc.errors(), "Exceptions", page, html);
    renderTypes(packageDoc.enums(), "Enums", page, html);
    renderTypes(packageDoc.annotationTypes(), "Annotation Types", page, html);
}
 
開發者ID:nicolaschriste,項目名稱:docdown,代碼行數:17,代碼來源:PackageContentRenderable.java

示例12: containingPackage

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
public PackageDoc containingPackage()
{
   Class outerClass = clazz;
   while (null != outerClass.getDeclaringClass()) {
      outerClass = outerClass.getDeclaringClass();
   }

   String packageName = outerClass.getName();
   int ndx = packageName.lastIndexOf('.');
   if (ndx > 0) {
      packageName = packageName.substring(0, ndx);
   }
   else {
      packageName = "";
   }
   PackageDoc result =  Main.getRootDoc().findOrCreatePackageDoc(packageName);
   return result;
}
 
開發者ID:cfriedt,項目名稱:classpath,代碼行數:19,代碼來源:ClassDocReflectedImpl.java

示例13: set

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
public boolean set(String[] optionArr)
{
   try {
      PackageMatcher packageMatcher = new PackageMatcher();

      StringTokenizer tokenizer = new StringTokenizer(optionArr[2], ":");
      while (tokenizer.hasMoreTokens()) {
         String packageWildcard = tokenizer.nextToken();
         packageMatcher.addWildcard(packageWildcard);
      }

      SortedSet<PackageDoc> groupPackages = packageMatcher.filter(rootDoc.specifiedPackages());

      packageGroups.add(new PackageGroup(optionArr[1], groupPackages));

      return true;
   }
   catch (InvalidPackageWildcardException e) {
      return false;
   }
}
 
開發者ID:cfriedt,項目名稱:classpath,代碼行數:22,代碼來源:AbstractDoclet.java

示例14: addUsedBy

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 *  @param usedClassToPackagesMap  ClassDoc to (PackageDoc to (UsageType to (Set of Doc)))
 */
private void addUsedBy(Map<ClassDoc,Map<PackageDoc,Map<UsageType,Set<Doc>>>> usedClassToPackagesMap,
                       ClassDoc usedClass, UsageType usageType, Doc user, PackageDoc userPackage)
{
   Map<PackageDoc,Map<UsageType,Set<Doc>>> packageToUsageTypeMap = usedClassToPackagesMap.get(usedClass);
   if (null == packageToUsageTypeMap) {
      packageToUsageTypeMap = new HashMap<PackageDoc,Map<UsageType,Set<Doc>>>();
      usedClassToPackagesMap.put(usedClass, packageToUsageTypeMap);
   }

   Map<UsageType,Set<Doc>> usageTypeToUsersMap = packageToUsageTypeMap.get(userPackage);
   if (null == usageTypeToUsersMap) {
     usageTypeToUsersMap = new TreeMap<UsageType,Set<Doc>>();
      packageToUsageTypeMap.put(userPackage, usageTypeToUsersMap);
   }

   Set<Doc> userSet = usageTypeToUsersMap.get(usageType);
   if (null == userSet) {
      userSet = new TreeSet<Doc>(); // FIXME: we need the collator from Main here
      usageTypeToUsersMap.put(usageType, userSet);
   }
   userSet.add(user);
}
 
開發者ID:cfriedt,項目名稱:classpath,代碼行數:26,代碼來源:AbstractDoclet.java

示例15: toPackageNode

import com.sun.javadoc.PackageDoc; //導入依賴的package包/類
/**
 * Returns the XML node corresponding to the specified ClassDoc.
 *
 * @param doc The package to transform.
 */
private static XMLNode toPackageNode(PackageDoc doc) {
  XMLNode node = new XMLNode("package", doc);

  // Core attributes
  node.attribute("name", doc.name());

  // Comments
  node.child(toShortComment(doc));
  node.child(toComment(doc));

  // Child nodes
  node.child(toAnnotationsNode(doc.annotations()));
  node.child(toStandardTags(doc));
  node.child(toTags(doc));
  node.child(toSeeNodes(doc.seeTags()));

  return node;
}
 
開發者ID:bazooka,項目名稱:bazooka-wo-xmldoclet,代碼行數:24,代碼來源:XMLDoclet.java


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