Search in sources :

Example 1 with EntityBuilderProxy

use of io.requery.proxy.EntityBuilderProxy in project requery by requery.

the class EntityReader method fromBuilder.

final <B> E fromBuilder(ResultSet results, Attribute[] selection) throws SQLException {
    EntityBuilderProxy<B, E> proxy = new EntityBuilderProxy<>(type);
    int index = 1;
    for (Attribute expression : selection) {
        @SuppressWarnings("unchecked") Attribute<E, ?> attribute = (Attribute<E, ?>) expression;
        if (attribute.getPrimitiveKind() != null) {
            readPrimitiveField(proxy, attribute, results, index);
        } else {
            Object value = mapping.read((Expression) attribute, results, index);
            proxy.setObject(attribute, value, PropertyState.LOADED);
        }
        index++;
    }
    return proxy.build();
}
Also used : EntityBuilderProxy(io.requery.proxy.EntityBuilderProxy) WHERE(io.requery.sql.Keyword.WHERE) QueryAttribute(io.requery.meta.QueryAttribute) Attribute(io.requery.meta.Attribute)

Aggregations

Attribute (io.requery.meta.Attribute)1 QueryAttribute (io.requery.meta.QueryAttribute)1 EntityBuilderProxy (io.requery.proxy.EntityBuilderProxy)1 WHERE (io.requery.sql.Keyword.WHERE)1