當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。