using value conversion/factory to encode objects in blobs
using value conversion/factory to encode objects in blobs
- Subject: using value conversion/factory to encode objects in blobs
- From: "email@hidden" <email@hidden>
- Date: Sat, 25 Feb 2017 17:19:59 +0100
Hi there,
this must be WebObjects 101 and I must be blind as a bat, but ... how on earth does one use the value conversion/factory model support to represent e.g., an attribute containing an NSDictionary (or another custom data object) by a BLOB containing archived data?
Far as I understand the support, I specify the desired EO-side class, plus an instance method to archive it to NSData, plus a class method (in Javaspeak presumably a static one) to initialise an instance from NSData. But... there are no such methods far as I know for most data classes. E.g., I would need something like
class NSDictionary ... {
static NSDictionary theMethodToBeUsedForValueFactory(NSData data) {
ByteArrayInputStream bis=new ByteArrayInputStream(data.bytes())
ObjectInputStream is=new ObjectInputStream(bis)
return objectInputStream.readObject()
}
NSData theMethodToBeUsedForValueConversion() {
ByteArrayOutputStream bos=new ByteArrayOutputStream();
ObjectOutputStream os=new ObjectOutputStream(bos)
os.writeObject(this)
os.flush()
return new NSData(bos.toByteArray())
}
}
none of which, far as I know, actually exists. In Objective C the solution would be trivial, I would simply add appropriate methods through a category; but the bloody Java thing has no similar support.
What am I missing and how does one solve this?
Thanks a lot,
OC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden