package org.jfox.dao.mapping;

import java.lang.reflect.InvocationTargetException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author <a href="mailto:yangyong@ufsoft.com.cn">Young Yang</a>
 */

public class ByteArrayColumnMapping extends ColumnMapping {

    public ByteArrayColumnMapping(String columnName, Class type) {
        super(columnName, type);
    }

    public void doFillStatement(PreparedStatement pst, Object value, int index) throws SQLException, IllegalAccessException, InvocationTargetException {
        pst.setBytes(index,(byte[])value);
    }

    public void doFillObject(Object target, ResultSet rset) throws SQLException, IllegalAccessException, InvocationTargetException {
        getSetterMethod().invoke(target,new Object[]{rset.getBytes(getColumnName())});
    }

    public static void main(String[] args) {

    }
}

