Package com.google.gwt.user.rebind

Examples of com.google.gwt.user.rebind.SourceWriter


    sw.print(context.parameterName);
  }

  @Override
  void writeExtractorJSNIReference(FragmentGeneratorContext context) {
    SourceWriter sw = context.sw;
    sw.print("@com.google.gwt.jsio.client.impl.JSONWrapperUtil::STRING_EXTRACTOR");
  }
View Full Code Here


* Encapsulates accessors for JSWrapper properties.
*/
class JSWrapperFragmentGenerator extends FragmentGenerator {
  protected void writeJSNIObjectCreator(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    SourceWriter sw = context.sw;
    JClassType returnType = context.returnType.isClassOrInterface().getErasedType();

    sw.print("@");
    sw.print(context.qualifiedTypeName);
    sw.print("::");
    sw.print("__create__");
    sw.print(returnType.getQualifiedSourceName().replaceAll("\\.", "_"));
    sw.print("()()");
    sw.print(".@com.google.gwt.jsio.client.JSWrapper::setJavaScriptObject(Lcom/google/gwt/core/client/JavaScriptObject;)(");
    sw.print(context.parameterName);
    sw.print(")");

    context.creatorFixups.add(returnType);
  }
View Full Code Here

    context.creatorFixups.add(returnType);
  }

  protected void writeJSNIValue(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    SourceWriter sw = context.sw;
    sw.print(".@com.google.gwt.jsio.client.JSWrapper::getJavaScriptObject()()");
  }
View Full Code Here

  @Override
  final void fromJS(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    context.parentLogger.branch(TreeLogger.DEBUG,
        "Building string value getter statement", null);
    SourceWriter sw = context.sw;

    // arg == null ? null : (arg.__gwtPeer || <new object>.setJSO(arg));

    sw.print(context.parameterName);
    sw.print(" == null ? null : ");
    sw.print("(");
    sw.print(context.parameterName);
    sw.print(".");
    sw.print(JSWrapperGenerator.BACKREF);
    sw.print(" || ");
    writeJSNIObjectCreator(context);
    sw.print(")");
  }
View Full Code Here

  @Override
  final void toJS(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    context.parentLogger.branch(TreeLogger.DEBUG,
        "Building string value setter statement", null);
    SourceWriter sw = context.sw;
    sw.print(context.parameterName);
    sw.print(" == null ? null : ");
    sw.print(context.parameterName);
    writeJSNIValue(context);
  }
View Full Code Here

  }

  @Override
  void writeExtractorJSNIReference(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    SourceWriter sw = context.sw;
    JClassType elementType = context.returnType.isClassOrInterface().getErasedType();

    sw.print("@");
    sw.print(context.qualifiedTypeName);
    sw.print("::");
    sw.print("__create__");
    sw.print(elementType.getQualifiedSourceName().replaceAll("\\.", "_"));
    sw.print("()().@com.google.gwt.jsio.client.JSWrapper::getExtractor()()");

    context.creatorFixups.add(elementType);
  }
View Full Code Here

  @Override
  void toJS(FragmentGeneratorContext context) throws UnableToCompleteException {
    context.parentLogger.branch(TreeLogger.DEBUG,
        "Building string value setter statement", null);
    SourceWriter sw = context.sw;
    sw.print("eval(");
    sw.print(context.parameterName);
    sw.print(".@com.google.gwt.jsio.client.JSOpaque::reference)");
  }
View Full Code Here

  }

  @Override
  void writeExtractorJSNIReference(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    SourceWriter sw = context.sw;
    sw.print("@com.google.gwt.jsio.client.impl.JSONWrapperUtil::JSOPAQUE_EXTRACTOR");
  }
View Full Code Here

                composerFactory.addImport(Serializer.class.getName());
                composerFactory.addImport(SerializationException.class.getName());
                composerFactory.addImport(Serializable.class.getName());

                composerFactory.setSuperclass(typeName);
                SourceWriter sourceWriter = composerFactory.createSourceWriter(context, printWriter);
                sourceWriter.print("private Serializer SERIALIZER = new " + realize + "();");
                sourceWriter.print("protected Serializer getRPCSerializer() {return SERIALIZER;}");
                sourceWriter.commit(logger);

            } catch (NotFoundException e) {
                logger.log(TreeLogger.ERROR, "", e);
                throw new UnableToCompleteException();
            }
View Full Code Here

  @Override
  protected void writeJSNIObjectCreator(FragmentGeneratorContext context)
      throws UnableToCompleteException {

    TypeOracle typeOracle = context.typeOracle;
    SourceWriter sw = context.sw;
    JParameterizedType listType = context.returnType.isParameterized();
    JType argumentType = listType.getTypeArgs()[0];
    TreeLogger logger = context.parentLogger.branch(TreeLogger.DEBUG,
        "Writing JSNI object creator for "
            + argumentType.getQualifiedSourceName(), null);

    sw.print("@com.google.gwt.jsio.client.impl.JSListWrapper::create(Lcom/google/gwt/jsio/client/impl/Extractor;)(");

    FragmentGenerator fragmentGenerator = context.fragmentGeneratorOracle.findFragmentGenerator(
        logger, typeOracle, argumentType.isClassOrInterface());

    FragmentGeneratorContext subParams = new FragmentGeneratorContext(context);
    subParams.returnType = argumentType;

    fragmentGenerator.writeExtractorJSNIReference(subParams);
    sw.print(")");
    sw.print(".@com.google.gwt.jsio.client.JSWrapper::setJavaScriptObject(Lcom/google/gwt/core/client/JavaScriptObject;)(");
    sw.print(context.parameterName);
    sw.print(")");
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.rebind.SourceWriter

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.