Examples of JClassType


Examples of com.google.gwt.core.ext.typeinfo.JClassType

          "No parameters specified for method " + method.getName()
              + "().  (First parameter must be a JavaScriptObject.)", null);
      throw new UnableToCompleteException();
    }
    JParameter param = method.getParameters()[0];
    JClassType paramType = param.getType().isClassOrInterface();
    JField f;

    if (context.typeOracle.findType(JavaScriptObject.class.getName()).equals(
        paramType)) {
      context.objRef = param.getName();
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

    context.parameterName = "jso";
    sw.print(params[0].getType().getQualifiedSourceName());
    sw.print(" ");
    sw.print(context.parameterName);

    JClassType bindingType = null;
    if (params.length == 2) {
      // Infer the binding type from the second parameter of the binding
      // method.
      bindingType = params[1].getType().isClassOrInterface();
      context.objRef = "obj";

      sw.print(", ");
      sw.print(bindingType.getQualifiedSourceName());
      sw.print(" ");
      sw.print(context.objRef);
    } else if (bindingAnnotation != null
        && bindingAnnotation.value().length() > 0) {
      // Use the binding type specified in the the gwt.binding annotation.
      bindingType = typeOracle.findType(bindingAnnotation.value());
      if (bindingType == null) {
        logger.log(TreeLogger.ERROR, "Could not resolve binding type "
            + bindingType, null);
        throw new UnableToCompleteException();
      }
    }

    sw.println(") {");
    sw.indent();

    for (Task t : context.tasks) {
      if (t.imported != null) {
        String fieldName = t.getFieldName(logger);
        sw.print("assert JSONWrapperUtil.hasField(");
        sw.print(context.parameterName);
        sw.print(", \"");
        sw.print(fieldName);
        sw.print("\") : \"Backing JSO missing imported function ");
        sw.print(fieldName);
        sw.println("\";");
      }
    }

    sw.print(binding.getName());
    sw.print("Native (");
    sw.print(context.parameterName);
    if (params.length == 2) {
      sw.print(",");
      sw.print(context.objRef);
    }
    sw.println(");");
    sw.outdent();
    sw.println("}");

    // Write the native half to perform the actual binding operations
    sw.print("public native void ");
    sw.print(binding.getName());
    sw.print("Native (");
    sw.print(params[0].getType().getQualifiedSourceName());
    sw.print(" ");
    sw.print(context.parameterName);
    if (params.length == 2) {
      sw.print(", ");
      sw.print(bindingType.getQualifiedSourceName());
      sw.print(" ");
      sw.print(context.objRef);
    }
    sw.println(") /*-{");
    sw.indent();
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

    sw.print("}");
  }

  @Override
  boolean accepts(TypeOracle typeOracle, JType type) {
    JClassType asClass = type.isClassOrInterface();

    if (asClass == null) {
      return false;
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

    TreeLogger logger = context.parentLogger.branch(TreeLogger.DEBUG,
        "Writing function() wrapper for JSFunction", null);

    SourceWriter sw = context.sw;
    TypeOracle typeOracle = context.typeOracle;
    JClassType functionClass = context.returnType.isClassOrInterface();

    if (functionClass.equals(typeOracle.findType(JSFunction.class.getName()))) {
      logger.log(TreeLogger.ERROR, "You must use a subinterface of JSFunction"
          + " so that the generator can extract a method signature.", null);
      throw new UnableToCompleteException();
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

    }

    @Override
    public boolean shouldImport(TreeLogger logger, TypeOracle typeOracle,
        JMethod method) throws UnableToCompleteException {
      JClassType enclosing = method.getEnclosingType();
      String methodName = method.getName();
      int arguments = method.getParameters().length;

      boolean hasBindingTag = JSWrapperGenerator.hasTag(logger, method,
          Binding.class) != null;
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

      return !(hasBindingTag || methodHasBeanTag || (propertyAccessor
          && !hasImportTag && classHasBeanTag));
    }

    protected boolean isJsoOrPeer(TypeOracle oracle, JType type) {
      JClassType jsoType = oracle.findType(JavaScriptObject.class.getName()).isClass();
      return jsoType.isAssignableFrom(type.isClass())
          || (PeeringFragmentGenerator.findPeer(oracle, type) != null);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

      return false;
    }

    public boolean shouldImplement(TreeLogger logger, TypeOracle typeOracle,
        JMethod method) throws UnableToCompleteException {
      JClassType enclosing = method.getEnclosingType().getErasedType();
      JClassType operableType = typeOracle.findType(getOperableClassName()).getErasedType();
      // JParameterizedType asParam = enclosing.isParameterized();
      // if (asParam != null) {
      // enclosing = asParam.get
      // }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

      return method.isAbstract() && !enclosing.equals(operableType);
    }

    public boolean shouldImport(TreeLogger logger, TypeOracle typeOracle,
        JMethod method) throws UnableToCompleteException {
      JClassType enclosing = method.getEnclosingType();
      String methodName = method.getName();
      int arguments = method.getParameters().length;

      boolean hasImportTag = JSWrapperGenerator.hasTag(logger, method,
          Imported.class) != null;
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

* Encapsulates accessors for JavaScriptObjects.
*/
class JavaScriptObjectFragmentGenerator extends FragmentGenerator {
  @Override
  boolean accepts(TypeOracle oracle, JType type) {
    JClassType asClass = type.isClassOrInterface();
    if (asClass == null) {
      return false;
    } else {
      return isAssignable(oracle, asClass, JavaScriptObject.class);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JClassType

* objects and their backing JavaScriptObject.
*/
class PeeringFragmentGenerator extends JSWrapperFragmentGenerator {

  static JField findPeer(TypeOracle oracle, JType type) {
    JClassType asClass = type.isClassOrInterface();

    while (asClass != null) {
      JField f = asClass.findField(JSWrapperGenerator.OBJ);
      if (f != null
          && isAssignable(oracle, f.getType().isClassOrInterface(),
              JavaScriptObject.class)) {
        return f;
      }

      asClass = asClass.getSuperclass();
    }

    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.