Package rocket.generator.rebind

Examples of rocket.generator.rebind.GeneratorContext


    }
    writer.println("{");
  }

  protected void log() {
    final GeneratorContext context = this.getGeneratorContext();

    if (context.isDebugEnabled()) {
      final StringBuffer buf = new StringBuffer();

      if (this.isStatic()) {
        buf.append("static ");
      }
      if (this.isAbstract()) {
        buf.append("abstract ");
      }
      if (this.isFinal()) {
        buf.append("final ");
      }
      buf.append(this.getVisibility().getName());
      buf.append(' ');

      buf.append(this.isInterface() ? "interface " : "class ");

      buf.append(this.getSimpleName());

      context.branch();

      context.debug(buf.toString());

      this.logSuperType();
      this.logImplementedInterfaces();

      context.unbranch();
    }
  }
View Full Code Here


    this.superType = superType;
  }

  public NewNestedType newNestedType() {
    final NewNestedTypeImpl type = new NewNestedTypeImpl();
    final GeneratorContext context = this.getGeneratorContext();
    type.setGeneratorContext(context);
    type.setSuperType(context.getObject());

    this.addNestedType(type);
    return type;
  }
View Full Code Here

    return type;
  }

  public NewNestedInterfaceType newNestedInterfaceType() {
    final NewNestedInterfaceTypeImpl type = new NewNestedInterfaceTypeImpl();
    final GeneratorContext context = this.getGeneratorContext();
    type.setGeneratorContext(context);
    type.setSuperType(context.getObject());

    this.addNestedInterfaceType(type);
    return type;
  }
View Full Code Here

    this.getGeneratorContext().addType(nestedType);
  }

  public NewAnonymousNestedType newAnonymousNestedType() {
    final NewAnonymousNestedTypeImpl type = new NewAnonymousNestedTypeImpl();
    final GeneratorContext context = this.getGeneratorContext();
    type.setGeneratorContext(context);
    type.setEnclosingType(type);
    type.setSuperType(context.getObject());
    context.addType(type);
    return type;
  }
View Full Code Here

  public boolean isPrimitive() {
    return false;
  }

  protected void logSuperType() {
    final GeneratorContext context = this.getGeneratorContext();
    if (context.isDebugEnabled()) {
      final Type superType = this.getSuperType();
      final Type object = context.getObject();
      if (false == superType.equals(object)) {
        context.debug("extends " + this.getSuperType().getName());
      }
    }
  }
View Full Code Here

      }
    }
  }

  protected void logImplementedInterfaces() {
    final GeneratorContext context = this.getGeneratorContext();
    if (context.isDebugEnabled()) {

      final Set<Type> interfaces = this.getInterfaces();
      if (false == interfaces.isEmpty()) {
        context.branch();
        context.debug("implements");

        final Iterator<Type> interfacesIterator = interfaces.iterator();
        while (interfacesIterator.hasNext()) {
          final Type interfacee = interfacesIterator.next();
          context.debug(interfacee.getName());
        }

        context.unbranch();
      }
    }
  }
View Full Code Here

    if (false == constructors.isEmpty()) {

      final Set<Constructor> sorted = new TreeSet<Constructor>(ConstructorComparator.INSTANCE);
      sorted.addAll(constructors);

      final GeneratorContext context = this.getGeneratorContext();
      context.branch();

      final String message = "Constructors";
      context.debug(message);

      writer.beginJavaDocComment();
      writer.print(message);
      writer.endJavaDocComment();

      writer.println();
      GeneratorHelper.writeClassComponents(sorted, writer, false, true);
      writer.println();

      context.unbranch();
    }
  }
View Full Code Here

    final Set<Field> fields = this.getFields();
    if (false == fields.isEmpty()) {
      final Set<Field> sorted = new TreeSet<Field>(FieldComparator.INSTANCE);
      sorted.addAll(fields);

      final GeneratorContext context = this.getGeneratorContext();
      context.branch();

      final String message = "Fields";
      context.debug(message);

      writer.beginJavaDocComment();
      writer.print(message);
      writer.endJavaDocComment();

      writer.println();
      GeneratorHelper.writeClassComponents(sorted, writer, false, true);
      writer.println();

      context.unbranch();
    }
  }
View Full Code Here

    if (false == methods.isEmpty()) {

      final Set<Method> sorted = new TreeSet<Method>(MethodComparator.INSTANCE);
      sorted.addAll(methods);

      final GeneratorContext context = this.getGeneratorContext();
      context.branch();

      final String message = "Methods";
      context.debug(message);

      writer.beginJavaDocComment();
      writer.print(message);
      writer.endJavaDocComment();

      writer.println();
      GeneratorHelper.writeClassComponents(sorted, writer, false, true);
      writer.println();

      context.unbranch();
    }
  }
View Full Code Here

    if (false == types.isEmpty()) {

      final Set<Type> sorted = new TreeSet<Type>(TypeComparator.INSTANCE);
      sorted.addAll(types);

      final GeneratorContext context = this.getGeneratorContext();
      context.branch();

      final String message = "Nested Types";
      context.debug(message);

      writer.beginJavaDocComment();
      writer.print(message);
      writer.endJavaDocComment();

      writer.println();
      GeneratorHelper.writeClassComponents(sorted, writer, false, true);
      writer.println();

      context.unbranch();
    }
  }
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.GeneratorContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.