Den 08.07.2011 19:00, skrev Greg Brown:
"that the Serializer interface encapsulates." -> "what the Serializer interface
encapsulates."
As you stated earlier, the Serializer is not supposed to perform
transformations and such, just create object instances based on the source.
Chris's suggestions might go beyond what the Serializer contract describes.
I assume you are talking about BXMLSerializer specifically, rather than the
Serializer interface? The Serializer contract is simply:
- Given an input stream, return an object
- Given an object and an output stream, write the object
BXMLSerializer specifically returns the object represented by the root element of the BXML
document. Other serializers obviously deserialize objects via different means, but they all
return a single object. Serializers that need to return multiple objects can simply return a
collection. For example, JSONSerializer returns a List when it reads "[0, 1, 2]", and
BXMLSerializer will return an ArrayList if the root element of the document is<ArrayList>.
It atleast breaks with BXMLSerializer, but one could argue it breaks
with Serializer as well - if you write an object you expect to get the
same object back when you read back the stream you wrote earlier. If you
add some mutator to it, that's not serialization anymore, that's
something else IMHO :)
-- Edvin