Examples of JField


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

              + "().  (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();

    } else if ((f = PeeringFragmentGenerator.findPeer(context.typeOracle,
        paramType)) != null) {
      context.objRef = param.getName() + ".@"
          + f.getEnclosingType().getQualifiedSourceName() + "::" + f.getName();

    } else {
      context.parentLogger.branch(TreeLogger.ERROR,
          "Invalid first parameter type for flyweight imported function. "
              + "It is not a JavaScriptObject and it lacks a jsoPeer field.",
View Full Code Here

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

  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();
View Full Code Here

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

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

    while (asClass != null) {
      JField f = asClass.findField(JSWrapperGenerator.EXTRACTOR);
      if (f != null
          && isAssignable(oracle, f.getType().isClassOrInterface(),
              Extractor.class)) {
        return f;
      }
      asClass = asClass.getSuperclass();
    }
View Full Code Here

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

  }

  @Override
  protected void writeJSNIValue(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    JField f = findPeer(context.typeOracle, context.returnType);
    if (f == null) {
      context.parentLogger.log(TreeLogger.ERROR, "The type or a supertype of "
          + context.returnType.getQualifiedSourceName() + " must possess a "
          + JSWrapperGenerator.OBJ + " field to be used as a parameter type.",
          null);
      throw new UnableToCompleteException();
    }
    SourceWriter sw = context.sw;
    sw.print(".@");
    sw.print(f.getEnclosingType().getQualifiedSourceName());
    sw.print("::");
    sw.print(f.getName());
  }
View Full Code Here

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

  }

  @Override
  void writeExtractorJSNIReference(FragmentGeneratorContext context)
      throws UnableToCompleteException {
    JField f = findExtractor(context.typeOracle, context.returnType);

    if (f == null) {
      context.parentLogger.log(TreeLogger.ERROR, "The type or a supertype of "
          + context.returnType.getQualifiedSourceName() + " must possess a "
          + JSWrapperGenerator.EXTRACTOR + " field to be used with a JSList",
          null);
      throw new UnableToCompleteException();
    }

    SourceWriter sw = context.sw;

    sw.print("@");
    sw.print(f.getEnclosingType().getQualifiedSourceName());
    sw.print("::");
    sw.print(f.getName());
  }
View Full Code Here

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

          }
        }

        if (nextType == null) {
          for (JClassType superType : type.isClassOrInterface().getFlattenedSupertypeHierarchy()) {
            JField field = superType.isClassOrInterface().findField(localPath[i]);
            if (field != null && field.isPublic()) {
              nextType = field.getType();
              break;
            }
          }
        }
        type = nextType;
View Full Code Here

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

      CollectFieldData field, TypeParameterLookup typeParamLookup,
      int[] nextEnumOrdinal) {
    Map<Class<? extends Annotation>, Annotation> declaredAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
    resolveAnnotations(logger, field.getAnnotations(), declaredAnnotations);
    String name = field.getName();
    JField jfield;
    if ((field.getAccess() & Opcodes.ACC_ENUM) != 0) {
      assert (type.isEnum() != null);
      jfield = new JEnumConstant(type, name, declaredAnnotations,
          nextEnumOrdinal[0]++);
    } else {
      jfield = new JField(type, name, declaredAnnotations);
    }

    // Get modifiers.
    //
    jfield.addModifierBits(mapBits(ASM_TO_SHARED_MODIFIERS, field.getAccess()));

    String signature = field.getSignature();
    JType fieldType;
    if (signature != null) {
      SignatureReader reader = new SignatureReader(signature);
      JType[] fieldTypeRef = new JType[1];
      reader.acceptType(new ResolveTypeSignature(resolver, binaryMapper,
          logger, fieldTypeRef, typeParamLookup, null));
      fieldType = fieldTypeRef[0];
      // TraceSignatureVisitor trace = new TraceSignatureVisitor(
      // methodData.getAccess());
      // reader.acceptType(trace);
      // System.err.println("Field " + name + ": " + trace.getDeclaration());

    } else {
      fieldType = resolveType(Type.getType(field.getDesc()));
    }
    if (fieldType == null) {
      return false;
    }
    jfield.setType(fieldType);
    return true;
  }
View Full Code Here

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

   * @param fieldName field name
   * @return the field
   */
  public static JField getField(JClassType clazz, String fieldName)
    {
      JField field = null;
      JClassType superClass = clazz;
      while (field == null && superClass != null)
      {
        field = superClass.findField(fieldName);
        superClass = superClass.getSuperclass();
View Full Code Here

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

   * @param name
   * @return
   */
  public static JField getDeclaredField(JClassType clazz, String name) throws NoSuchFieldException
  {
    JField field = clazz.getField(name);
    if (field == null)
    {
      if (clazz.getSuperclass() == null)
      {
        throw new NoSuchFieldException(name);
View Full Code Here

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

      {
        propertyType = method.getReturnType();
      }
      else
      {
        JField field = JClassUtils.getField(clazz, propertyName);
        if (field != null)
        {
          propertyType = field.getType();
        }
      }
      return propertyType;
   
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.