org.xillium.data.persistence.xml.Row Maven / Gradle / Ivy
package org.xillium.data.persistence.xml;
//import java.util.*;
import java.util.logging.*;
import java.lang.reflect.*;
import org.xillium.base.beans.Beans;
import org.xillium.data.DataObject;
/**
* A java bean mapped to a sql-rs:row element.
*/
public class Row {
private static final Logger _logger = Logger.getLogger(Row.class.getName());
public final T data;
/**
* Constructs a Row object. All but the last argument are to be passed in from a BurnedInArgumentObjectFactory.
*
* @param type - a subclass of DataObject that defines public fields that match the columns in the XML document.
*/
public Row(Class type) throws Exception {
this.data = type.newInstance();
}
public void add(Column column) throws Exception {
try {
Field field = Beans.getKnownField(data.getClass(), column.name);
Beans.setValue(data, Beans.getKnownField(data.getClass(), column.name), column.data);
} catch (Exception x) {
// ignore
}
}
}