Пример #1
0
  /**
   * Parses a field type definition
   *
   * @param docField
   * @return
   */
  protected static Field ParseField(FieldDoc docField) {
    assert (docField != null);

    Field xmlField = new Field();

    xmlField.name = docField.name();
    xmlField.comment = docField.commentText();
    xmlField.type = ParseType(docField.type());
    xmlField.isFinal = docField.isFinal();
    if (xmlField.isFinal) {
      xmlField.finalExpression = docField.constantValueExpression();
    } else if (docField.constantValueExpression() != null) {
      // how would a non-final field have a constant value expression?
      // my understanding is that this field is only != null when is not final
      assert (false);
    }
    xmlField.isStatic = docField.isStatic();
    xmlField.isVolatile = docField.isVolatile();
    xmlField.isTransient = docField.isTransient();
    xmlField.scope = DetermineScope(docField);

    // parse annotations from the field
    xmlField.annotationInstances =
        ParseAnnotationInstances(docField.annotations(), docField.qualifiedName());

    return xmlField;
  }
  private void importField(DbJVClass dbClaz, Field field) throws DbException {
    if (dbClaz == null) {
      return;
    }

    DbJVDataMember member = new DbJVDataMember(dbClaz);
    member.setName(field.getName());

    // set field type
    Type type = field.getType();
    member.setType(toAdt(type));
    member.setTypeUse(toTypeUse(type));

    // set field modifiers
    member.setFinal(field.isFinal());
    member.setStatic(field.isStatic());
    member.setTransient(field.isTransient());
    member.setVisibility(toVisibility(field));
    member.setVolatile(field.isVolatile());
  }