Package rocket.generator.rebind

Examples of rocket.generator.rebind.GeneratorContext


   *            xml documents.
   */
  protected void recordAliases(final Set<Alias> aliases) {
    Checker.notNull("parameter:aliases", aliases);

    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.info("Processing all alias (" + aliases.size() + ") tags.");

    final Iterator<Alias> iterator = aliases.iterator();
    while (iterator.hasNext()) {
      final Alias alias = iterator.next();
      final String name = alias.getName();
      final String bean = alias.getBean();

      context.debug(name + "=" + bean);

      this.checkAlias(alias);

      this.addAlias(alias);
    }

    context.unbranch();
  }
View Full Code Here


    writer.println(stringWriter.toString());
    writer.endJavaDocComment();
  }

  protected void log() {
    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.info(this.getVisibility().getName() + (this.isInterface() ? " class " : " interface ") + this.getName());

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

    context.unbranch();
  }
View Full Code Here

    return JavaGeneratorContext.getVisibility(this.getJavaMethod().getModifiers());
  }

  @SuppressWarnings("unchecked")
  protected List<MethodParameter> createParameters() {
    final GeneratorContext context = this.getGeneratorContext();
    final List<MethodParameter> parameters = new ArrayList<MethodParameter>();
    final Class[] parameterTypes = this.getJavaMethod().getParameterTypes();
    final java.lang.reflect.Method javaMethod = this.getJavaMethod();

    for (int i = 0; i < parameterTypes.length; i++) {
      final Class parameterType = parameterTypes[i];

      final JavaMethodParameterAdapter adapter = new JavaMethodParameterAdapter();
      adapter.setGeneratorContext(context);
      adapter.setJavaMethod(javaMethod);
      adapter.setName("parameter" + i);
      adapter.setType(context.getType(parameterType.getName()));

      parameters.add(adapter);
    }
    return parameters;
  }
View Full Code Here

    throw new UnsupportedOperationException();
  }

  @SuppressWarnings("unchecked")
  protected Set<Constructor> createConstructors() {
    final GeneratorContext context = this.getGeneratorContext();

    final Set<Constructor> constructors = new HashSet<Constructor>();

    final java.lang.reflect.Constructor[] javaConstructors = this.getJavaClass().getDeclaredConstructors();
    for (int i = 0; i < javaConstructors.length; i++) {
View Full Code Here

    return Collections.unmodifiableSet(constructors);
  }

  protected Set<Field> createFields() {
    final GeneratorContext context = this.getGeneratorContext();

    final Set<Field> fields = new HashSet<Field>();

    final java.lang.reflect.Field[] javaFields = this.getJavaClass().getDeclaredFields();
    for (int i = 0; i < javaFields.length; i++) {
View Full Code Here

    return this.getJavaGeneratorContext().asTypes(this.getJavaClass().getInterfaces());
  }

  @Override
  protected Set<Method> createMethods() {
    final GeneratorContext context = this.getGeneratorContext();

    final Set<Method> methods = new HashSet<Method>();
    final java.lang.reflect.Method[] javaMethods = this.getJavaClass().getDeclaredMethods();
    for (int i = 0; i < javaMethods.length; i++) {
      final java.lang.reflect.Method javaMethod = javaMethods[i];
View Full Code Here

  protected Visibility createVisibility() {
    return JavaGeneratorContext.getVisibility(this.getJavaConstructor().getModifiers());
  }

  protected List<ConstructorParameter> createParameters() {
    final GeneratorContext context = this.getGeneratorContext();
    final List<ConstructorParameter> parameters = new ArrayList<ConstructorParameter>();

    final Class[] parameterTypes = this.getJavaConstructor().getParameterTypes();
    for (int i = 0; i < parameterTypes.length; i++) {
      final JavaConstructorParameterAdapter parameter = new JavaConstructorParameterAdapter();
      parameter.setGeneratorContext(this.getGeneratorContext());
      parameter.setType(context.getType(parameterTypes[i].getName()));
      parameter.setName("parameter" + i);

      parameters.add(parameter);
    }
View Full Code Here

    Checker.notNull("parameter:writer", writer);

    final Set<Initializer> initializers = this.getInitializers();
    if (false == initializers.isEmpty()) {

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

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

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

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

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

   * @return a Set of NewType sub types
   */
  protected Set<NewType> getNewSubTypes() {
    final Set<NewType> subTypes = new HashSet<NewType>();

    final GeneratorContext context = this.getGeneratorContext();
    final Iterator<NewType> newTypesIterator = context.getNewTypes().iterator();

    while (newTypesIterator.hasNext()) {
      final NewType newType = newTypesIterator.next();
      if (newType.getSuperType() == this) {
        subTypes.add(newType);
View Full Code Here

  }

  public void write(final SourceWriter writer) {
    Checker.notNull("parameter:writer", writer);

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

    this.writeComments(writer);

    this.writeDeclaration(writer);
    writer.indent();
    this.writeInitializers(writer);
    this.writeConstructors(writer);
    this.writeFields(writer);
    this.writeMethods(writer);
    this.writeNestedTypes(writer);
    writer.outdent();

    writer.println("} // " + this.getNestedName());

    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.