Add support for encoding date/time attributes in TextSerializationFactory.

Also fixes a bug in DataStreamValueSerializer that was calling ValueSerializer.write
with the Optional<Object> instance instead of the Object itself, and in
TextValueSerializer that was calling toString() on Optional.get() instead
of Optional.orNull().