01: package com.completex.objective.components.persistency.type;
02:
03: import java.sql.SQLException;
04: import java.sql.Blob;
05:
06: /**
07: * @author Gennady Krizhevsky
08: */
09: public class DetachedBlobTypeHandler extends BlobTypeHandler {
10: public Object transformRead(Object data) throws SQLException {
11: if (data == null) {
12: return null;
13: }
14: if (data instanceof Blob) {
15: return new DetachedBlobImpl(((Blob) data));
16: } else if (data instanceof byte[]) {
17: return new DetachedBlobImpl(((byte[]) data));
18: } else {
19: throw new IllegalArgumentException("Unexpected data type: "
20: + data.getClass().getName());
21: }
22: }
23: }
|