Package com.google.gwt.core.ext.typeinfo

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


        }
      } else {
        if ("other".equals(value)) {
          out.println("default:  // other");
        } else if (enumType != null) {
          JField field = enumType.findField(value);
          JEnumConstant enumConstant = null;
          if (field != null) {
            enumConstant = field.isEnumConstant();
          }
          if (field == null || enumConstant == null) {
            throw error(logger, "'" + value + "' is not a valid value of "
                + enumType.getQualifiedSourceName() + " or 'other'");
          }
View Full Code Here


  }

  private void createSingleImport(XMLElement elem, JClassType enclosingType,
      String rawFieldName, String constantName)
      throws UnableToCompleteException {
    JField field = enclosingType.findField(constantName);
    if (field == null) {
      writer.die(elem, "Unable to locate a field named %s in %s", constantName,
          enclosingType.getQualifiedSourceName());
    } else if (!field.isStatic()) {
      writer.die(elem, "Field %s in type %s is not static", constantName,
          enclosingType.getQualifiedSourceName());
    }

    JType importType = field.getType();
    JClassType fieldType;
    if (importType instanceof JPrimitiveType) {
      fieldType = oracle.findType(((JPrimitiveType) importType).getQualifiedBoxedSourceName());
    } else {
      fieldType = (JClassType) importType;
View Full Code Here

  public String init(TypeOracle oracle, JField targetWidget, JType targetType, JField targetFieldType,
                     JField targetEntityField, String variable, List<JField> fields) {
    StringBuilder builder = new StringBuilder(variable + ".setDefaultTitleValues(new String[] {");

    Iterator<JField> iter = fields.iterator();
    JField fld;
    String fieldName;
    while (iter.hasNext()) {
      if ((fld = iter.next()).isAnnotationPresent(FriendlyName.class)) {
        fieldName = fld.getAnnotation(FriendlyName.class).value();
      }
      else {
        fieldName = fld.getName();
      }

      builder.append("\"").append(fieldName).append("\"");
      if (iter.hasNext()) builder.append(", ");
    }
View Full Code Here

        return new MetaField.ArrayLengthMetaField(this);
      }
      return null;
    }

    JField field = type.findField(name);
    while ((field == null || (field != null && !field.isPublic())) &&
        (type = type.getSuperclass()) != null && !type.getQualifiedSourceName().equals("java.lang.Object")) {
      field = type.findField(name);

      for (final JClassType interfaceType : type.getImplementedInterfaces()) {
        field = interfaceType.findField(name);
View Full Code Here

        return new MetaField.ArrayLengthMetaField(this);
      }
      return null;
    }

    JField field = type.findField(name);

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

  private Annotation getAnnotation(PropertyDescriptor p, boolean useField,
      Class<? extends Annotation> expectedAnnotationClass) {
    Annotation annotation = null;
    if (useField) {
      JField field = beanType.findField(p.getPropertyName());
      if (field.getEnclosingType().equals(beanType)) {
        annotation = field.getAnnotation(expectedAnnotationClass);
      }
    } else {
      JMethod method = beanType.findMethod(asGetter(p), NO_ARGS);
      if (method.getEnclosingType().equals(beanType)) {
        annotation = method.getAnnotation(expectedAnnotationClass);
View Full Code Here

      sw.print(getQualifiedSourceNonPrimitiveType(beanHelper.getElementType(p,
          true)));
      sw.print(") value");
    } else {
      sw.print("object, ");
      JField field = beanType.getField(propertyName);
      if (field.isPublic()) {
        sw.print("object.");
        sw.print(propertyName);
      } else {
        fieldsToWrap.add(field);
        sw.print(toWrapperName(field) + "(object)");
View Full Code Here

  }

  private void createSingleImport(XMLElement elem, JClassType enclosingType,
      String rawFieldName, String constantName)
      throws UnableToCompleteException {
    JField field = enclosingType.findField(constantName);
    if (field == null) {
      writer.die(elem, "Unable to locate a field named %s in %s", constantName,
          enclosingType.getQualifiedSourceName());
    } else if (!field.isStatic()) {
      writer.die(elem, "Field %s in type %s is not static", constantName,
          enclosingType.getQualifiedSourceName());
    }

    JType importType = field.getType();
    JClassType fieldType;
    if (importType instanceof JPrimitiveType) {
      fieldType = oracle.findType(((JPrimitiveType) importType).getQualifiedBoxedSourceName());
    } else {
      fieldType = (JClassType) importType;
View Full Code Here

        injected = true;
        StringBuilder sb = new StringBuilder(providerInjector.getType(injectContext, injectionPoint) + ".provide(");

        switch (injectionPoint.getTaskType()) {
            case Field:
                JField field = injectionPoint.getField();
                JClassType type = field.getType().isClassOrInterface();

                JParameterizedType pType = type.isParameterized();
                if (pType != null) {
                    JClassType[] typeArgs = pType.getTypeArgs();
                    for (int i = 0; i < typeArgs.length; i++) {
View Full Code Here

        return new MetaField.ArrayLengthMetaField(this);
      }
      return null;
    }

    final JField field = type.getField(name);

    if (field == null) {
      throw new RuntimeException("no such field: " + name + " in class: " + this);
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JField

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.