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

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(58)

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

JFormatter.write介绍

[英]Generates the whole source code out of the specified class.
[中]从指定的类生成整个源代码。

代码示例

代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel

void build( CodeWriter src, CodeWriter res ) throws IOException {
  // write classes
  for (JDefinedClass c : classes.values()) {
    if (c.isHidden())
      continue;   // don't generate this file
    JFormatter f = createJavaSourceFileWriter(src, c.name());
    f.write(c);
    f.close();
  }
  // write package annotations
  if(annotations!=null || jdoc!=null) {
    JFormatter f = createJavaSourceFileWriter(src,"package-info");
    if (jdoc != null)
      f.g(jdoc);
    // TODO: think about importing
    if (annotations != null){
      for (JAnnotationUse a : annotations)
        f.g(a).nl();
    }
    f.d(this);
    f.close();
  }
  // write resources
  for (JResourceFile rsrc : resources) {
    CodeWriter cw = rsrc.isResource() ? res : src;
    OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name()));
    rsrc.build(os);
    os.close();
  }
}

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

void build( CodeWriter src, CodeWriter res ) throws IOException {
  // write classes
  for (JDefinedClass c : classes.values()) {
    if (c.isHidden())
      continue;   // don't generate this file
    JFormatter f = createJavaSourceFileWriter(src, c.name());
    f.write(c);
    f.close();
  }
  // write package annotations
  if(annotations!=null || jdoc!=null) {
    JFormatter f = createJavaSourceFileWriter(src,"package-info");
    if (jdoc != null)
      f.g(jdoc);
    // TODO: think about importing
    if (annotations != null){
      for (JAnnotationUse a : annotations)
        f.g(a).nl();
    }
    f.d(this);
    f.close();
  }
  // write resources
  for (JResourceFile rsrc : resources) {
    CodeWriter cw = rsrc.isResource() ? res : src;
    OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name()));
    rsrc.build(os);
    os.close();
  }
}

代码示例来源:origin: org.glassfish.metro/webservices-tools

void build( CodeWriter src, CodeWriter res ) throws IOException {
  // write classes
  for (JDefinedClass c : classes.values()) {
    if (c.isHidden())
      continue;   // don't generate this file
    JFormatter f = createJavaSourceFileWriter(src, c.name());
    f.write(c);
    f.close();
  }
  // write package annotations
  if(annotations!=null || jdoc!=null) {
    JFormatter f = createJavaSourceFileWriter(src,"package-info");
    if (jdoc != null)
      f.g(jdoc);
    // TODO: think about importing
    if (annotations != null){
      for (JAnnotationUse a : annotations)
        f.g(a).nl();
    }
    f.d(this);
    f.close();
  }
  // write resources
  for (JResourceFile rsrc : resources) {
    CodeWriter cw = rsrc.isResource() ? res : src;
    OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name()));
    rsrc.build(os);
    os.close();
  }
}

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

void build( CodeWriter src, CodeWriter res ) throws IOException {
  // write classes
  for (JDefinedClass c : classes.values()) {
    if (c.isHidden())
      continue;   // don't generate this file
    JFormatter f = createJavaSourceFileWriter(src, c.name());
    f.write(c);
    f.close();
  }
  // write package annotations
  if(annotations!=null || jdoc!=null) {
    JFormatter f = createJavaSourceFileWriter(src,"package-info");
    if (jdoc != null)
      f.g(jdoc);
    // TODO: think about importing
    if (annotations != null){
      for (JAnnotationUse a : annotations)
        f.g(a).nl();
    }
    f.d(this);
    f.close();
  }
  // write resources
  for (JResourceFile rsrc : resources) {
    CodeWriter cw = rsrc.isResource() ? res : src;
    OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name()));
    rsrc.build(os);
    os.close();
  }
}

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

void build( CodeWriter src, CodeWriter res ) throws IOException {
  // write classes
  for (JDefinedClass c : classes.values()) {
    if (c.isHidden())
      continue;   // don't generate this file
    JFormatter f = createJavaSourceFileWriter(src, c.name());
    f.write(c);
    f.close();
  }
  // write package annotations
  if(annotations!=null || jdoc!=null) {
    JFormatter f = createJavaSourceFileWriter(src,"package-info");
    if (jdoc != null)
      f.g(jdoc);
    // TODO: think about importing
    if (annotations != null){
      for (JAnnotationUse a : annotations)
        f.g(a).nl();
    }
    f.d(this);
    f.close();
  }
  // write resources
  for (JResourceFile rsrc : resources) {
    CodeWriter cw = rsrc.isResource() ? res : src;
    OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name()));
    rsrc.build(os);
    os.close();
  }
}

相关文章