Package com.google.gwt.autobean.rebind.model

Examples of com.google.gwt.autobean.rebind.model.AutoBeanType


    sw.println("}");
  }

  private void writeMethods(SourceWriter sw) throws UnableToCompleteException {
    for (AutoBeanFactoryMethod method : model.getMethods()) {
      AutoBeanType autoBeanType = method.getAutoBeanType();
      // public AutoBean<Foo> foo(FooSubtype wrapped) {
      sw.println("public %s %s(%s) {",
          method.getReturnType().getQualifiedSourceName(), method.getName(),
          method.isWrapper()
              ? (method.getWrappedType().getQualifiedSourceName() + " wrapped")
              : "");
      if (method.isWrapper()) {
        sw.indent();
        // AutoBean<Foo> toReturn = AutoBeanUtils.getAutoBean(wrapped);
        sw.println("%s toReturn = %s.getAutoBean(wrapped);",
            method.getReturnType().getParameterizedQualifiedSourceName(),
            AutoBeanUtils.class.getCanonicalName());
        sw.println("if (toReturn != null) {return toReturn;}");
        // return new FooAutoBean(Factory.this, wrapped);
        sw.println("return new %s(%s.this, wrapped);",
            autoBeanType.getQualifiedSourceName(), simpleSourceName);
        sw.outdent();
      } else {
        // return new FooAutoBean(Factory.this);
        sw.indentln("return new %s(%s.this);",
            autoBeanType.getQualifiedSourceName(), simpleSourceName);
      }
      sw.println("}");
    }
  }
View Full Code Here


  private void writeReturnWrapper(SourceWriter sw, AutoBeanType type,
      AutoBeanMethod method) throws UnableToCompleteException {
    if (!method.isValueType() && !method.isNoWrap()) {
      JMethod jmethod = method.getMethod();
      JClassType returnClass = jmethod.getReturnType().isClassOrInterface();
      AutoBeanType peer = model.getPeer(returnClass);

      sw.println("if (toReturn != null) {");
      sw.indent();
      sw.println("if (%s.this.isWrapped(toReturn)) {",
          type.getSimpleSourceName());
      sw.indentln("toReturn = %s.this.getFromWrapper(toReturn);",
          type.getSimpleSourceName());
      sw.println("} else {");
      sw.indent();
      if (peer != null) {
        // toReturn = new FooAutoBean(getFactory(), toReturn).as();
        sw.println("toReturn = new %s(getFactory(), toReturn).as();",
            peer.getQualifiedSourceName());
      }
      sw.outdent();
      sw.println("}");

      sw.outdent();
View Full Code Here

    sw.println("}");
  }

  private void writeMethods(SourceWriter sw) throws UnableToCompleteException {
    for (AutoBeanFactoryMethod method : model.getMethods()) {
      AutoBeanType autoBeanType = method.getAutoBeanType();
      // public AutoBean<Foo> foo(FooSubtype wrapped) {
      sw.println("public %s %s(%s) {",
          method.getReturnType().getQualifiedSourceName(), method.getName(),
          method.isWrapper()
              ? (method.getWrappedType().getQualifiedSourceName() + " wrapped")
              : "");
      if (method.isWrapper()) {
        sw.indent();
        // AutoBean<Foo> toReturn = AutoBeanUtils.getAutoBean(wrapped);
        sw.println("%s toReturn = %s.getAutoBean(wrapped);",
            method.getReturnType().getParameterizedQualifiedSourceName(),
            AutoBeanUtils.class.getCanonicalName());
        sw.println("if (toReturn != null) {return toReturn;}");
        // return new FooAutoBean(Factory.this, wrapped);
        sw.println("return new %s(%s.this, wrapped);",
            autoBeanType.getQualifiedSourceName(), simpleSourceName);
        sw.outdent();
      } else {
        // return new FooAutoBean(Factory.this);
        sw.indentln("return new %s(%s.this);",
            autoBeanType.getQualifiedSourceName(), simpleSourceName);
      }
      sw.println("}");
    }
  }
View Full Code Here

  private void writeReturnWrapper(SourceWriter sw, AutoBeanType type,
      AutoBeanMethod method) throws UnableToCompleteException {
    if (!method.isValueType() && !method.isNoWrap()) {
      JMethod jmethod = method.getMethod();
      JClassType returnClass = jmethod.getReturnType().isClassOrInterface();
      AutoBeanType peer = model.getPeer(returnClass);

      sw.println("if (toReturn != null) {");
      sw.indent();
      sw.println("if (%s.this.isWrapped(toReturn)) {",
          type.getSimpleSourceName());
      sw.indentln("toReturn = %s.this.getFromWrapper(toReturn);",
          type.getSimpleSourceName());
      sw.println("} else {");
      sw.indent();
      if (peer != null) {
        // toReturn = new FooAutoBean(getFactory(), toReturn).as();
        sw.println("toReturn = new %s(getFactory(), toReturn).as();",
            peer.getQualifiedSourceName());
      }
      sw.outdent();
      sw.println("}");

      sw.outdent();
View Full Code Here

TOP

Related Classes of com.google.gwt.autobean.rebind.model.AutoBeanType

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.