当前位置: 首页>>代码示例>>Java>>正文


Java PackageElement.isUnnamed方法代码示例

本文整理汇总了Java中javax.lang.model.element.PackageElement.isUnnamed方法的典型用法代码示例。如果您正苦于以下问题:Java PackageElement.isUnnamed方法的具体用法?Java PackageElement.isUnnamed怎么用?Java PackageElement.isUnnamed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.lang.model.element.PackageElement的用法示例。


在下文中一共展示了PackageElement.isUnnamed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bundleFileFromClass

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
private String bundleFileFromClass(TreePath classTreePath, String bfn) {
    TypeMirror tm = info.getTrees().getTypeMirror(classTreePath);
    if (tm.getKind() != TypeKind.DECLARED) {
        return null;
    }
    Element clazz = ((DeclaredType)tm).asElement();
    while ((clazz instanceof TypeElement)) {
        clazz = ((TypeElement)clazz).getEnclosingElement();
    }
    if (clazz.getKind() == ElementKind.PACKAGE) {
        PackageElement pack = ((PackageElement)clazz);
        if (pack.isUnnamed()) {
            return null;
        }
        return pack.getQualifiedName().toString().replaceAll("\\.", "/") + "/" + bfn;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ResourceStringFoldProvider.java

示例2: addPackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void addPackageName(PackageElement pkg, Content summariesTree, boolean first) {
    Content pkgNameContent;
    if (!first && configuration.allowTag(HtmlTag.SECTION)) {
        summariesTree.addContent(summaryTree);
    }
    if (pkg.isUnnamed()) {
        summariesTree.addContent(getMarkerAnchor(
                SectionName.UNNAMED_PACKAGE_ANCHOR));
        pkgNameContent = contents.defaultPackageLabel;
    } else {
        String parsedPackageName = utils.parsePackageName(pkg);
        summariesTree.addContent(getMarkerAnchor(parsedPackageName));
        pkgNameContent = getPackageLabel(parsedPackageName);
    }
    Content headingContent = new StringContent(".*");
    Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
            pkgNameContent);
    heading.addContent(headingContent);
    if (configuration.allowTag(HtmlTag.SECTION)) {
        summaryTree = HtmlTree.SECTION(heading);
    } else {
        summariesTree.addContent(heading);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:ConstantsSummaryWriterImpl.java

示例3: KickbackElementClass

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
public KickbackElementClass(VariableElement variableElement, Elements elementUtils) throws VerifyException {
    KickbackElement kickbackElement = variableElement.getAnnotation(KickbackElement.class);
    Weak weak = variableElement.getAnnotation(Weak.class);
    Soft soft = variableElement.getAnnotation(Soft.class);
    PackageElement packageElement = elementUtils.getPackageOf(variableElement);
    this.variableElement = variableElement;
    this.packageName = packageElement.isUnnamed() ? null : packageElement.getQualifiedName().toString();
    this.typeName = TypeName.get(variableElement.asType());
    this.clazzName = variableElement.getSimpleName().toString();
    this.value = variableElement.getConstantValue();
    if(weak != null) this.isWeak = true;
    else this.isWeak = false;
    if(soft != null) this.isSoft = true;
    else this.isSoft = false;

    if(kickbackElement != null) {
        this.elementName =  StringUtils.toUpperCamel(Strings.isNullOrEmpty(kickbackElement.name()) ? this.clazzName : kickbackElement.name());
    } else {
        this.elementName = StringUtils.toUpperCamel(this.clazzName);
    }

    checkPrimitiveType();
    checkModifierValidate();
    checkAnnotationValidate();
}
 
开发者ID:skydoves,项目名称:Kickback,代码行数:26,代码来源:KickbackElementClass.java

示例4: addPackagesList

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Adds list of packages in the index table. Generate link to each package.
 *
 * @param packages Packages to which link is to be generated
 * @param tbody the documentation tree to which the list will be added
 */
protected void addPackagesList(Collection<PackageElement> packages, Content tbody) {
    boolean altColor = true;
    for (PackageElement pkg : packages) {
        if (!pkg.isUnnamed()) {
            if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
                Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, packageLinkContent);
                HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
                tdSummary.addStyle(HtmlStyle.colLast);
                addSummaryComment(pkg, tdSummary);
                HtmlTree tr = HtmlTree.TR(thPackage);
                tr.addContent(tdSummary);
                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                tbody.addContent(tr);
            }
        }
        altColor = !altColor;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:PackageIndexWriter.java

示例5: addLinkToPackageContent

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void addLinkToPackageContent(PackageElement pkg,
        Set<PackageElement> printedPackageHeaders, Content contentListTree) {
    //add link to summary
    Content link;
    if (pkg.isUnnamed()) {
        link = getHyperLink(getDocLink(
                SectionName.UNNAMED_PACKAGE_ANCHOR),
                contents.defaultPackageLabel, "", "");
    } else {
        String parsedPackageName = utils.parsePackageName(pkg);
        Content packageNameContent = getPackageLabel(parsedPackageName);
        packageNameContent.addContent(".*");
        link = getHyperLink(DocLink.fragment(parsedPackageName),
                packageNameContent, "", "");
        PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(pkg);
        printedPackageHeaders.add(abbrevPkg);
    }
    contentListTree.addContent(HtmlTree.LI(link));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:ConstantsSummaryWriterImpl.java

示例6: getPackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
public static String getPackageName(Elements elements, TypeElement typeElement) throws NoPackageNameException {
    PackageElement pkg = elements.getPackageOf(typeElement);
    if (pkg.isUnnamed()) {
        throw new NoPackageNameException(typeElement);
    }
    return pkg.getQualifiedName().toString();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:Utils.java

示例7: parsePackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Parse the package name.  We only want to display package name up to
 * 2 levels.
 */
public String parsePackageName(PackageElement p) {
    String pkgname = p.isUnnamed() ? "" : getPackageName(p);
    int index = -1;
    for (int j = 0; j < MAX_CONSTANT_VALUE_INDEX_LENGTH; j++) {
        index = pkgname.indexOf(".", index + 1);
    }
    if (index != -1) {
        pkgname = pkgname.substring(0, index);
    }
    return pkgname;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Utils.java

示例8: getPackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
public static String getPackageName(Elements elementUtils, TypeElement type) throws IOException {
  PackageElement pkg = elementUtils.getPackageOf(type);
  if (!pkg.isUnnamed()) {
    return pkg.getQualifiedName().toString();
  } else {
    return ""; // Default package
  }
}
 
开发者ID:globulus,项目名称:easyprefs,代码行数:9,代码来源:TypeUtils.java

示例9: getPackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
static String getPackageName(Elements elementUtils, TypeElement type)
    throws UnnamedPackageException {
  PackageElement pkg = elementUtils.getPackageOf(type);
  if (pkg.isUnnamed()) {
    throw new UnnamedPackageException(type);
  }
  return pkg.getQualifiedName().toString();
}
 
开发者ID:Comcast,项目名称:resourceprovider,代码行数:9,代码来源:Utils.java

示例10: visitPackage

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
@Override
public PrintingElementVisitor visitPackage(PackageElement e, Boolean p) {
    defaultAction(e, false);
    if (!e.isUnnamed())
        writer.println("package " + e.getQualifiedName() + ";");
    else
        writer.println("// Unnamed package");
    return this;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:PrintingProcessor.java

示例11: allUnnamedClasses

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Return all of the classes specified on the command-line that belong to the given package.
 *
 * @param packageName the name of the package specified on the command-line.
 */
public SortedSet<TypeElement> allUnnamedClasses() {
    for (PackageElement pkg : allClasses.keySet()) {
        if (pkg.isUnnamed()) {
            return allClasses.get(pkg);
        }
    }
    return new TreeSet<>(comparator);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:TypeElementCatalog.java

示例12: forRoot

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Return the inverse path for a package.
 * For example, if the package is java.lang,
 * the inverse path is ../...
 */
public static DocPath forRoot(PackageElement pkgElement) {
    String name = (pkgElement == null || pkgElement.isUnnamed())
            ? ""
            : pkgElement.getQualifiedName().toString();
    return new DocPath(name.replace('.', '/').replaceAll("[^/]+", ".."));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DocPath.java

示例13: getNamedPackage

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
PackageElement getNamedPackage(List<PackageElement> list, int idx) {
    if (idx < list.size()) {
        PackageElement pkg = list.get(idx);
        if (pkg != null && !pkg.isUnnamed()) {
            return pkg;
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:HtmlDoclet.java

示例14: generatePackageFiles

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override // defined by AbstractDoclet
protected void generatePackageFiles(ClassTree classtree) throws DocletException {
    Set<PackageElement> packages = configuration.packages;
    if (packages.size() > 1 && configuration.frames) {
        PackageIndexFrameWriter.generate(configuration);
    }
    List<PackageElement> pList = new ArrayList<>(packages);
    PackageElement prev = null;
    for (int i = 0 ; i < pList.size() ; i++) {
        // if -nodeprecated option is set and the package is marked as
        // deprecated, do not generate the package-summary.html, package-frame.html
        // and package-tree.html pages for that package.
        PackageElement pkg = pList.get(i);
        if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
            if (configuration.frames) {
                PackageFrameWriter.generate(configuration, pkg);
            }
            int nexti = i + 1;
            PackageElement next = null;
            if (nexti < pList.size()) {
                next = pList.get(nexti);
                // If the next package is unnamed package, skip 2 ahead if possible
                if (next.isUnnamed() && ++nexti < pList.size()) {
                   next = pList.get(nexti);
                }
            }
            AbstractBuilder packageSummaryBuilder =
                    configuration.getBuilderFactory().getPackageSummaryBuilder(
                    pkg, prev, next);
            packageSummaryBuilder.build();
            if (configuration.createtree) {
                PackageTreeWriter.generate(configuration, pkg, prev, next,
                        configuration.nodeprecated);
            }
            prev = pkg;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:HtmlDoclet.java

示例15: isExternal

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Determine if a element item is externally documented.
 *
 * @param element an Element.
 * @return true if the element is externally documented
 */
public boolean isExternal(Element element) {
    if (packageToItemMap == null) {
        return false;
    }
    PackageElement pe = configuration.utils.containingPackage(element);
    if (pe.isUnnamed()) {
        return false;
    }
    return packageToItemMap.get(configuration.utils.getPackageName(pe)) != null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Extern.java


注:本文中的javax.lang.model.element.PackageElement.isUnnamed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。