/**
   * Return the declared <code>JavaField</code> for this <code>JavaClass</code>, identified by
   * <code>fieldName</code>.
   *
   * @param name the name of the <code>JavaField</code> to return.
   * @return the <code>JavaField</code> named <code>fieldName</code> from this <code>JavaClass
   *     </code>.
   */
  public JavaField getDeclaredField(String name) {
    Collection<JavaField> allFields = getDeclaredFields();

    for (Iterator<JavaField> iterator = allFields.iterator(); iterator.hasNext(); ) {
      JavaField field = iterator.next();
      if (field.getName().equals(name)) {
        return field;
      }
    }

    return null;
  }
Пример #2
0
 /**
  * Returns a JavaClass instance wrapping the provided field's resolved type.
  *
  * @param field
  * @return
  */
 public JavaClass getType(JavaField field) {
   JavaClass type = (JavaClass) field.getResolvedType();
   try {
     return jModel.getClass(type.getRawName());
   } catch (Exception x) {
   }
   return null;
 }