private Class<?> getResourceType(String alias, String localName, Map<String, Object> attributes) {
    String type = (String) attributes.get("type");

    if (type == null && "image".equals(localName)) {
      // special code for <ui:image> with no 'type' attribute
      return ImageResource.class;
    } else if (type == null && "style".equals(localName)) {
      // special code for <ui:style> with no 'type' attribute
      return CssResource.class;
    } else if (type == null && "data".equals(localName)) {
      // special code for <ui:data> with no 'type' attribute
      return DataResource.class;
    } else if (type == null) {
      throw new GwtTestUiBinderException(
          "<"
              + localName
              + "> element declared in "
              + owner.getClass().getSimpleName()
              + ".ui.xml must specify a 'type' attribute");
    }

    try {
      return GwtReflectionUtils.getClass(type);
    } catch (ClassNotFoundException e2) {
      throw new GwtTestUiBinderException(
          "Cannot find class '"
              + type
              + "' for resource '"
              + alias
              + "' declared in file '"
              + owner.getClass().getSimpleName()
              + ".ui.xml'");
    }
  }
    private void collectSingleImport(
        String importValue, Map<String, Object> resources, Object owner) {
      try {
        int token = importValue.lastIndexOf('.');
        String className = importValue.substring(0, token);
        Class<?> clazz = GwtReflectionUtils.getClass(className);
        String fieldName = importValue.substring(token + 1);

        Object objectToImport = GwtReflectionUtils.getStaticFieldValue(clazz, fieldName);

        // register static field value in UiResourcesManager inner map
        resources.put(fieldName, objectToImport);

      } catch (Exception e) {
        throw new GwtTestUiBinderException(
            "Error while trying to import ui field '" + importValue + "'", e);
      }
    }
    private void collectMultipleImports(
        String importValue, Map<String, Object> resources, Object owner) {

      try {
        String className = importValue.substring(0, importValue.lastIndexOf('.'));

        Class<?> clazz = GwtReflectionUtils.getClass(className);

        // this code handles classes and enums fine
        for (Field field : GwtReflectionUtils.getFields(clazz)) {
          if (Modifier.isStatic(field.getModifiers())
              && !Modifier.isPrivate(field.getModifiers())
              && !Modifier.isProtected(field.getModifiers())) {
            // register static field value in UiResourcesManager inner map
            Object value = GwtReflectionUtils.getStaticFieldValue(clazz, field.getName());
            resources.put(field.getName(), value);
          }
        }

      } catch (Exception e) {
        throw new GwtTestUiBinderException(
            "Error while trying to import multiple ui fields '" + importValue + "'", e);
      }
    }