com.sun.codemodel.JPackage.name()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.sun.codemodel.JPackage.name()方法的一些代码示例,展示了JPackage.name()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPackage.name()方法的具体详情如下:
包路径:com.sun.codemodel.JPackage
类名称:JPackage
方法名:name

JPackage.name介绍

[英]Name of the package. May be the empty string for the root package.
[中]包的名称。可能是根包的空字符串。

代码示例

代码示例来源:origin: javaee/glassfish

public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
  StandardLocation loc;
  if(fileName.endsWith(".java")) {
    // Annotation Processing doesn't do the proper Unicode escaping on Java source files,
    // so we can't rely on Filer.createSourceFile.
    loc = SOURCE_PATH;
  } else {
    // put non-Java files directly to the output folder
    loc = CLASS_PATH;
  }
  return filer.createResource(loc, pkg.name(), fileName).openOutputStream();
}

代码示例来源:origin: javaee/glassfish

public Writer openSource(JPackage pkg, String fileName) throws IOException {
  String name;
  if(pkg.isUnnamed())
    name = fileName;
  else
    name = pkg.name()+'.'+fileName;
  name = name.substring(0,name.length()-5);   // strip ".java"
  return filer.createSourceFile(name).openWriter();
}

代码示例来源:origin: fabric8io/kubernetes-client

resourceListClass.annotate(ApiGroup.class).param("value", apiGroup);
if (resourceClass.getPackage().name().startsWith("io.fabric8.kubernetes")) {
 JAnnotationArrayMember arrayMember = resourceClass.annotate(VelocityTransformations.class)
  .paramArray("value");
 arrayMember.annotate(VelocityTransformation.class).param("value", "/manifest.vm")
  .param("outputPath", "kubernetes.properties").param("gather", true);
} else if (resourceClass.getPackage().name().startsWith("io.fabric8.openshift")) {
 JAnnotationArrayMember arrayMember = resourceClass.annotate(VelocityTransformations.class)
  .paramArray("value");

代码示例来源:origin: uk.org.retep.tools/jaxb

@Override
  public boolean matches( final JPackage pkg,
              final Set<String> packages )
  {
    return packages.contains( pkg.name() );
  }
},

代码示例来源:origin: com.sun.codemodel/codemodel

public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
  String pkgName = pkg.name();
  if(pkgName.length()!=0)     pkgName += '.';
  
  out.println(
    "-----------------------------------" + pkgName+fileName +
    "-----------------------------------");
    
  return new FilterOutputStream(out) {
    public void close() {
      // don't let this stream close
    }
  };
}

代码示例来源:origin: com.sun.xml.ws/jaxws-tools

public Writer openSource(JPackage pkg, String fileName) throws IOException {
  String tmp = fileName.substring(0, fileName.length()-5);
  if (pkg.name() != null && ! "".equals(pkg.name())) {
    w = filer.createSourceFile(pkg.name() + "." + tmp).openWriter();
  } else {
    w = filer.createSourceFile(tmp).openWriter();
  }
  return w;
}

代码示例来源:origin: jpmml/jpmml-evaluator

@Override
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
  this.filer = OperationProcessor.super.processingEnv.getFiler();
  if(fileName.endsWith(".java")){
    fileName = fileName.substring(0, fileName.length() - ".java".length());
  }
  JavaFileObject sourceFile = this.filer.createSourceFile(pkg.name() + "." + fileName);
  return sourceFile.openOutputStream();
}

代码示例来源:origin: com.sun.codemodel/codemodel

private void report(JPackage pkg, String fileName) {
  if(pkg.isUnnamed()) progress.println(fileName);
  else
    progress.println(
      pkg.name().replace('.',File.separatorChar)
        +File.separatorChar+fileName);
}

代码示例来源:origin: org.jvnet.jaxbcommons/jaxbcommons-core

public static String getContextPath(GeneratorContext context) {
 final StringBuffer sb = new StringBuffer();
 final PackageContext[] packageContexts = context.getAllPackageContexts();
 for (int index = 0; index < packageContexts.length; index++) {
  final PackageContext packageContext = packageContexts[index];
  final String packageName = (String) packageContext._package.name();
  sb.append(packageName);
  if (index < packageContexts.length - 1)
   sb.append(':');
 }
 return sb.toString();
}

代码示例来源:origin: sun-jaxb/jaxb-xjc

private void report(JPackage pkg, String fileName) {
  if(pkg.isUnnamed()) progress.println(fileName);
  else
    progress.println(
      pkg.name().replace('.',File.separatorChar)
        +File.separatorChar+fileName);
}

代码示例来源:origin: com.github.webdriverextensions/webdriverextensions

@Override
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
  outputStream = processingEnv.getFiler().createSourceFile(pkg.name() + "." + StringUtils.removeEnd(fileName, ".java")).openOutputStream();
  return outputStream;
}

代码示例来源:origin: javaee/jaxb-v2

public String process(String line) {
    if(!line.startsWith("package ")) return line;
    // replace package decl
    if( pkg.isUnnamed() )
      return null;
    else
      return "package "+pkg.name()+";";
  }
};

代码示例来源:origin: javaee/jaxb-v2

public String fullName() {
  if(pkg.isUnnamed())
    return className;
  else
    return pkg.name()+'.'+className;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Returns the package name of this <code>JavaClass</code>.
 *
 * @return the <code>String</code> name of this <code>JavaClass'</code> <code>JavaPackage</code>.
 */
public String getPackageName() {
  return xjcClass._package().name();
}

代码示例来源:origin: org.jvnet.jaxb2_commons/jaxb2-basics-tools

public static String getContextPath(Outline context) {
  final StringBuilder sb = new StringBuilder();
  for (final Iterator<? extends PackageOutline> packageOutlines = context
      .getAllPackageContexts().iterator(); packageOutlines.hasNext();) {
    final PackageOutline packageOutline = packageOutlines.next();
    final String packageName = packageOutline._package().name();
    sb.append(packageName);
    if (packageOutlines.hasNext())
      sb.append(':');
  }
  return sb.toString();
}

代码示例来源:origin: highsource/maven-jaxb2-plugin

public OutputStream openBinary(JPackage pkg, String fileName)
    throws IOException {
  if (verbose) {
    if (pkg.isUnnamed())
      log.info("XJC writing: " + fileName);
    else
      log.info("XJC writing: "
          + pkg.name().replace('.', File.separatorChar)
          + File.separatorChar + fileName);
  }
  return core.openBinary(pkg, fileName);
}

代码示例来源:origin: highsource/maven-jaxb2-plugin

public Writer openSource(JPackage pkg, String fileName) throws IOException {
  if (verbose) {
    if (pkg.isUnnamed())
      log.info("XJC writing: " + fileName);
    else
      log.info("XJC writing: "
          + pkg.name().replace('.', File.separatorChar)
          + File.separatorChar + fileName);
  }
  return core.openSource(pkg, fileName);
}

代码示例来源:origin: highsource/maven-jaxb2-plugin

public Writer openSource(JPackage pkg, String fileName) throws IOException {
  if (verbose) {
    if (pkg.isUnnamed())
      log.info("XJC writing: " + fileName);
    else
      log.info("XJC writing: "
          + pkg.name().replace('.', File.separatorChar)
          + File.separatorChar + fileName);
  }
  return core.openSource(pkg, fileName);
}

代码示例来源:origin: org.jvnet.jaxbhelp/jaxbhelp-core

private String getFilePath(ClassContext classContext, FieldItem fieldItem) {
 final String path = classContext._package._package.name()
   + File.separator
   + ClassUtils.getLCN(classContext.target, false)
   + "."
   + fieldItem.name
   + getExtension();
 return path;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

private void dump( JPackage pkg ) throws IOException {
  println("package "+pkg.name()+" {");
  indent++;
  dumpChildren(pkg);
  indent--;
  println("}");
}

相关文章