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

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


    assertEquals(buttonType, providedOwnerField.getType().getRawType());
    assertTrue(providedOwnerField.isProvided());
  }

  public void testOwnerField_badFieldType() throws Exception {
    JField someGwtField = gwtTypeAdapter.adaptField(
        this.getClass().getDeclaredField("badTypeField"), ownerType);
    try {
      new OwnerField(someGwtField, MortalLogger.NULL, uiBinderCtx);
      fail("Expected exception not thrown.");
    } catch (UnableToCompleteException utce) {
View Full Code Here


      // Expected
    }
  }

  public void testOwnerField_missingAnnotation() throws Exception {
    JField someGwtField = gwtTypeAdapter.adaptField(
        this.getClass().getDeclaredField("nonAnnotatedField"), ownerType);
    try {
      new OwnerField(someGwtField, MortalLogger.NULL, uiBinderCtx);
      fail("Expected exception not thrown.");
    } catch (UnableToCompleteException utce) {
View Full Code Here

    JClassType type = getEnclosedMetaObject().isClassOrInterface();
    if (type == null) {
      return null;
    }

    JField field = type.getField(name);

    if (field == null) {
      throw new RuntimeException("no such field: " + field);
    }
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

    }
  }

  @Override
  public GeneratorTypeInfo getFieldType(String name, boolean allowProtected) {
    JField field = classType.getField(name);
    if(field != null && (field.isPublic() || (allowProtected && field.isProtected())))
      return wrap(field.getType());
    return null;
  }
View Full Code Here

      }
      return null;
    }


    JField field = type.getField(name);

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

                    if (creator != null) {
                        p("// We found a creator so we use the annotated constructor");
                        p("" + possibleType.clazz.getParameterizedQualifiedSourceName() + " rc = new " + possibleType.clazz.getParameterizedQualifiedSourceName() + "(");
                        i(1).p("// The arguments are placed in the order they appear within the annotated constructor").i(-1);
                        orderedFields = getOrderedFields(getFields(possibleType.clazz), creator);
                        final JField lastField = orderedFields.get(orderedFields.size() - 1);
                        for (final JField field : orderedFields) {
                            branch("Processing field: " + field.getName(), new Branch<Void>() {
                                @Override
                                public Void execute() throws UnableToCompleteException {
                                    Json jsonAnnotation = getAnnotation(field, Json.class);
View Full Code Here

                    if( f.getName().equals( name ) ){
                        found = true;
                        break;
                    }
                }
                JField f = type.findField( name );
                // is getter annotated, if yes use this annotation for the field
                JsonProperty propName = null;
                if ( entry.getValue().isAnnotationPresent(JsonProperty.class) ) {
                    propName = getAnnotation(entry.getValue(), JsonProperty.class);
                }
                // is setter annotated, if yes use this annotation for the field
                JMethod m = type.findMethod("s" + entry.getValue().getName().substring(1),
                        new JType[]{ entry.getValue().getReturnType() });
                if ( m != null && m.isAnnotationPresent(JsonProperty.class) ) {
                    propName = getAnnotation(m, JsonProperty.class);
                }
                // if have a field and an annotation from the getter/setter then use that annotation
                if ( propName != null && found && !f.getName().equals(propName.value())) {
                    allFields.remove(f);
                    DummyJField dummy = new DummyJField( name, entry.getValue().getReturnType() );
                    dummy.setAnnotation( propName );
                    allFields.add(dummy);
                }
                if ( ! found && !( f != null && f.isAnnotationPresent( JsonIgnore.class ) ) ){
                    DummyJField dummy = new DummyJField( name, entry.getValue().getReturnType() );
                    if ( entry.getValue().isAnnotationPresent(JsonProperty.class) ) {
                        dummy.setAnnotation( getAnnotation(entry.getValue(), JsonProperty.class) );
                    }
                    allFields.add( dummy );
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

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.