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


Java PackageElement.getQualifiedName方法代码示例

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


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

示例1: bundlevalue

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Converts a (possibly) localized string attribute in a layer into a value suitable for {@link org.openide.filesystems.annotations.LayerBuilder.File#bundlevalue(String,String)}.
 * @param attribute the result of {@link FileObject#getAttribute} on a {@code literal:*} key
 * @param declaration the declaring element (used to calculate package)
 * @return a string referring to the same (possibly) localized value (may be null)
 */
public @CheckForNull String bundlevalue(@NullAllowed Object attribute, Element declaration) {
    if (attribute instanceof String) {
        String val = (String) attribute;
        if (val.startsWith("bundle:")) {
            PackageElement pkg = findPackage(declaration);
            if (pkg != null) {
                String expected = "bundle:" + pkg.getQualifiedName() + ".Bundle#";
                if (val.startsWith(expected)) {
                    return val.substring(expected.length() - 1); // keep '#'
                }
            }
            return val.substring(7);
        }
        return val;
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Hinter.java

示例2: getTemplateText

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
private String getTemplateText(
    Filer filer,
    TypeElement templateType,
    PackageElement packageElement) throws IOException {
  CharSequence relativeName = templateType.getSimpleName() + ".generator";
  CharSequence packageName = packageElement.getQualifiedName();
  List<Exception> suppressed = Lists.newArrayList();
  try {
    return filer.getResource(StandardLocation.SOURCE_PATH, packageName, relativeName)
        .getCharContent(true)
        .toString();
  } catch (Exception cannotGetFromSourcePath) {
    suppressed.add(cannotGetFromSourcePath);
    try {
      return filer.getResource(StandardLocation.CLASS_OUTPUT, packageName, relativeName)
          .getCharContent(true)
          .toString();
    } catch (Exception cannotGetFromOutputPath) {
      suppressed.add(cannotGetFromOutputPath);
      try {
        return filer.getResource(StandardLocation.CLASS_PATH,
            "",
            packageName.toString().replace('.', '/') + '/' + relativeName)
            .getCharContent(true)
            .toString();
      } catch (IOException cannotGetFromClasspath) {
        for (Exception e : suppressed) {
          cannotGetFromClasspath.addSuppressed(e);
        }
        throw cannotGetFromClasspath;
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:Processor.java

示例3: preProcessWebService

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
protected void preProcessWebService(WebService webService, TypeElement element) {
    processedMethods = new HashSet<String>();
    seiContext = context.getSeiContext(element);
    String targetNamespace = null;
    if (webService != null)
        targetNamespace = webService.targetNamespace();
    PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element);
    if (targetNamespace == null || targetNamespace.length() == 0) {
        String packageName = packageElement.getQualifiedName().toString();
        if (packageName == null || packageName.length() == 0) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(
                    element.getQualifiedName()), element);
        }
        targetNamespace = RuntimeModeler.getNamespace(packageName);
    }
    seiContext.setNamespaceUri(targetNamespace);
    if (serviceImplName == null)
        serviceImplName = seiContext.getSeiImplName();
    if (serviceImplName != null) {
        seiContext.setSeiImplName(serviceImplName);
        context.addSeiContext(serviceImplName, seiContext);
    }
    portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_'));
    packageName = packageElement.getQualifiedName();
    portName = webService != null && webService.name() != null && webService.name().length() > 0 ?
            webService.name() : portName;
    serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue();
    serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ?
            webService.serviceName() : serviceName;
    wsdlNamespace = seiContext.getNamespaceUri();
    typeNamespace = wsdlNamespace;

    SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        pushedSoapBinding = pushSoapBinding(soapBinding, element, element);
    } else if (element.equals(typeElement)) {
        pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:WebServiceVisitor.java

示例4: CodeInjector

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
public CodeInjector(TypeElement classElement, Map<String,EgLanguage> languageForClassName, EgLanguage defaultLanguage) {
    this.classElement = classElement;
    this.languageForClassName = languageForClassName;
    this.defaultLanguage = languageForClassName.getOrDefault(AnnotationCollector.className(classElement), defaultLanguage);

    PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();
    this.packageName = ""+packageElement.getQualifiedName();
    if (EgLanguage.INHERIT.equals(this.defaultLanguage)) {
        throw new IllegalArgumentException("Cannot use INHERIT as a default EgTest language");
    }
}
 
开发者ID:dleppik,项目名称:EgTest,代码行数:12,代码来源:CodeInjector.java

示例5: CachingPackageElement

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
CachingPackageElement(PackageElement delegate) {
  super(delegate);
  this.delegate = delegate;
  this.qualifiedName = delegate.getQualifiedName();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:CachingElements.java

示例6: getEnclosingPackageName

import javax.lang.model.element.PackageElement; //导入方法依赖的package包/类
/**
 * Get the enclosed name of the package
 *
 * @param te  TypeElement
 * @return the name
 */
public String getEnclosingPackageName(TypeElement te) {

    PackageElement encl = configuration.utils.containingPackage(te);
    return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:HtmlDocWriter.java


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