Пример #1
0
 public void state(@Nonnull final JFormatter f) {
   if (JOp.hasTopOp(_test)) {
     f.print("while ").generable(_test);
   } else {
     f.print("while (").generable(_test).print(')');
   }
   if (_body != null) f.statement(_body);
   else f.print(';').newline();
 }
 public void state(JFormatter f) {
   if (JOp.hasTopOp(test)) {
     f.p("switch ").g(test).p(" {").nl();
   } else {
     f.p("switch (").g(test).p(')').p(" {").nl();
   }
   for (JCase c : cases) f.s(c);
   if (defaultCase != null) f.s(defaultCase);
   f.p('}').nl();
 }
Пример #3
0
 public void state(JFormatter f) {
   f.i();
   if (!isDefaultCase) {
     f.p("case ").g(label).p(':').nl();
   } else {
     f.p("default:").nl();
   }
   if (body != null) f.s(body);
   f.o();
 }
Пример #4
0
  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();
    }
  }
Пример #5
0
  public void generate(JFormatter f) {
    String name = this.name;
    if (name == null) name = var.name();

    if (object != null) {
      f.g(object).p('.').p(name);
    } else {
      if (explicitThis) {
        f.p("this.").p(name);
      } else {
        f.id(name);
      }
    }
  }
Пример #6
0
 public void generate(JFormatter f) {
   f.p(JExpr.quotify('"', str));
 }
 public void generate(JFormatter f) {
   f.p(what);
 }
Пример #8
0
 public void generate(@Nonnull final JFormatter f) {
   f.print(Integer.toString(m_nValue));
 }
Пример #9
0
 public void state(JFormatter f) {
   f.p(label + ':').nl();
 }
Пример #10
0
 public void generate(JFormatter f) {
   f.p(name);
 }
Пример #11
0
 public void declare(JFormatter f) {
   if (name.length() != 0) f.p("package").p(name).p(';').nl();
 }
Пример #12
0
 public void generate(@Nonnull final JFormatter f) {
   if ((m_nMods & JMod.PUBLIC) != 0) f.print("public");
   if ((m_nMods & JMod.PROTECTED) != 0) f.print("protected");
   if ((m_nMods & JMod.PRIVATE) != 0) f.print("private");
   if ((m_nMods & JMod.FINAL) != 0) f.print("final");
   if ((m_nMods & JMod.STATIC) != 0) f.print("static");
   if ((m_nMods & JMod.ABSTRACT) != 0) f.print("abstract");
   if ((m_nMods & JMod.NATIVE) != 0) f.print("native");
   if ((m_nMods & JMod.SYNCHRONIZED) != 0) f.print("synchronized");
   if ((m_nMods & JMod.TRANSIENT) != 0) f.print("transient");
   if ((m_nMods & JMod.VOLATILE) != 0) f.print("volatile");
   if ((m_nMods & JMod.DEFAULT) != 0) f.print("default");
   if ((m_nMods & JMod.STRICTFP) != 0) f.print("strictfp");
 }