コード例 #1
0
  public Vector getAttributeFromAll(String attributeName, Vector objects) {
    ClassDescriptor descriptor = getSession().getClassDescriptor(getReferenceClass());
    DirectToFieldMapping mapping =
        (DirectToFieldMapping) descriptor.getMappingForAttributeName(attributeName);

    Vector attributes = new Vector();
    Object currentObject;
    for (int i = 0; i < objects.size(); i++) {
      currentObject = objects.elementAt(i);
      if (currentObject.getClass() == ReportQueryResult.class) {
        attributes.addElement(((ReportQueryResult) currentObject).get(attributeName));
      } else {
        attributes.addElement(mapping.getAttributeValueFromObject(currentObject));
      }
    }
    return attributes;
  }