Examples of JField


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

    JMethod jMethod = JClassUtils.getMethod(clazz, JClassUtils.getGetterMethod(propertyName, clazz), new JType[]{});
    if (jMethod != null && (jMethod.isPublic() || (allowProtected && jMethod.isProtected())))
    {
      return (parentVariable+"."+jMethod.getName()+"()");
    }
    JField field = getField(clazz, propertyName);

    if (field.isPublic() || (allowProtected && field.isProtected()))
    {
      return parentVariable+"."+field.getName();
    }

    throw new CruxGeneratorException("Property ["+propertyName+"] could not be created. It is not visible neither has a getter/setter method.");
  }
View Full Code Here

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

      if (method == null) {
        method = getMethod(type, "has" + cap(p));
      }

      // Fall back to field
      JField field = getField(type, p);

      if (method != null) {
        sb.append(".").append(method.getName()).append("()");
        type = method.getReturnType().isClassOrInterface();
      } else if (field != null) {
        sb.append(".").append(p);
        type = field.getType().isClassOrInterface();
      } else {
        getLogger().log(Type.WARN, "Method get" + cap(p) + " could not be found");
        throw new NoSuchMethodException();
      }
View Full Code Here

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

    return type;
  }

  private JField getField(JClassType type, String p) {
    for (JClassType superType : type.getFlattenedSupertypeHierarchy()) {
      JField field = superType.findField(p);
      if (field != null && field.isPublic()){
        return field;
      }
    }
    return null;
  }
View Full Code Here

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

    }

    String methodName = "set" + cap(lastPathElement);

    JMethod method = getMethod(type, methodName);
    JField field = getField(type, lastPathElement);
    if (method != null && typesMatch(getValueType(), method.getParameterTypes()[0])) {
      sb.append(".").append(methodName).append("(").append(valueName).append(")");
    } else if (field != null && typesMatch(getValueType(), field.getType())) {
      sb.append(".").append(lastPathElement).append(" = ").append(valueName);
    } else {
      getLogger().log(Type.DEBUG, "Method " + methodName + " of type " + getValueType() + " could not be found.");
      return null;
    }
View Full Code Here

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

    String elseStm = "";
    JField[] fields = JClassUtils.getDeclaredFields(dtoType);
    for (int i = 0; i < fields.length; i++)
    {
      JField field = fields[i];
      String name = field.getName();
      JType type = field.getType();
      String typeName = type.getQualifiedSourceName();
     
      if (type.isPrimitive() != null)
      {
        JPrimitiveType jPrimitiveType = type.isPrimitive();
View Full Code Here

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

    JField[] fields = JClassUtils.getDeclaredFields(dtoType);
   
    String elseStm = "";
    for (int i = 0; i < fields.length; i++)
    {
      JField field = fields[i];
      String name = field.getName();
      JType type = field.getType();
      String typeName = type.getQualifiedSourceName();
     
      if (type.isPrimitive() != null)
      {
        JPrimitiveType jPrimitiveType = type.isPrimitive();
View Full Code Here

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

    JField[] fields = JClassUtils.getDeclaredFields(dtoType);
    String dtoTypeName = dtoType.getParameterizedQualifiedSourceName();
   
    for (int i = 0; i < fields.length; i++)
    {
      JField field = fields[i];
      String name = field.getName();
      JType fieldType = field.getType();
      String fieldTypeName = fieldType.getParameterizedQualifiedSourceName();
      String setterName = null;
      String getterName = null;

      if (fieldType.isPrimitive() != null)
      {
        JPrimitiveType jPrimitiveType = fieldType.isPrimitive();
        fieldTypeName = jPrimitiveType.getQualifiedBoxedSourceName();
      }
     
      try
      {
        setterName = dtoType.getMethod(ClassUtils.getSetterMethod(name), new JType[]{fieldType}).getName();
        getterName = dtoType.getMethod(ClassUtils.getGetterMethod(name), new JType[]{}).getName();
      }
      catch (NotFoundException e)
      {
        // do nothing
      }
     
      boolean isPublic = field.isPublic() && !field.isStatic();
      boolean hasGetterAndSetter = setterName != null && getterName != null;
      boolean isAccessible = isPublic || hasGetterAndSetter;
     
      if(isAccessible)
      {
View Full Code Here

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

    // Try to resolve annotations, ignore any that fail.
    Map<Class<? extends java.lang.annotation.Annotation>, java.lang.annotation.Annotation> declaredAnnotations = newAnnotationMap();
    resolveAnnotations(logger, jfield.annotations, declaredAnnotations);

    String name = String.valueOf(jfield.name);
    JField field;
    if (jfield.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
      assert (enclosingType.isEnum() != null);
      field = new JEnumConstant(enclosingType, name, declaredAnnotations,
          jfield.binding.original().id);
    } else {
      field = new JField(enclosingType, name, declaredAnnotations);
    }

    // Get modifiers.
    //
    field.addModifierBits(Shared.bindingToModifierBits(jfield.binding));

    // Set the field type.
    //
    TypeBinding jfieldType = jfield.binding.type;

    JType fieldType = resolveType(logger, jfieldType);
    if (fieldType == null) {
      // Unresolved type.
      //
      return false;
    }
    field.setType(fieldType);

    return true;
  }
View Full Code Here

Examples of com.google.gwt.dev.javac.typemodel.JField

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

    // Get modifiers.
    addModifierBits(jfield, mapBits(ASM_TO_SHARED_MODIFIERS, field.getAccess()));
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JField

              membersByCorrelation.put(c, member);
              classesMutable.add(member);
              break;
            }
            case FIELD: {
              JField field = c.getField();
              JDeclaredType type = c.getType();
              StandardFieldMember member = memberFactory.get(field);
              memberFactory.get(type).addField(member);
              membersByCorrelation.put(c, member);
              break;
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.