3

It is quite simple to do it, you write the object down to file, then you read it:

My questions are

  1. why when we put [RemoteClass(alias="foo.Bar")] into VO, it can be cast automatically (otherwise the type of the deserialized object is Generic Object with correct properties data inside it)?
  2. Is there another way to achieve it without RemoteClass tag? (Using metadata tag is preference)

Thanks

1 Answer 1

2
  1. The answer is in the page you linked to:

    Note that the alias is a key that is stored with the class instance and links the class definition with the specific object that is stored in the ByteArray when an instance of that object is serialized. This key can be any unique string identifying this class, but convention is to use the fully normalized package and class name.

    That's why you get a generic object if you omit the alias - the deserialization method does not know what to do with the data, unless you specify to which class the values should be mapped.

  2. Yes, there is: registerClassAlias() does the same thing. But the metadata tag is much prettier to read ;)

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I think you answered the question, though we decide to use data model-driven from Adobe which generate all sqlLite DAO code. No need to serialize/deserialize things any more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.