Package net.solarnetwork.codec
Class TemporalPropertySerializer
java.lang.Object
net.solarnetwork.codec.TemporalPropertySerializer
- All Implemented Interfaces:
PropertySerializer
Property serializer for dates and times.
- Since:
- 2.0
- Version:
- 1.0
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionTemporalPropertySerializer(String pattern) Constructor.TemporalPropertySerializer(String pattern, ZoneId zone) Constructor.TemporalPropertySerializer(DateTimeFormatter formatter) Constructor. -
Method Summary
-
Constructor Details
-
TemporalPropertySerializer
Constructor.The UTC time zone will be used.
- Parameters:
pattern- the pattern to use
-
TemporalPropertySerializer
Constructor.- Parameters:
pattern- the pattern to usezone- if not null then a zone to use
-
TemporalPropertySerializer
Constructor.- Parameters:
formatter- the formatter to use- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
serialize
Description copied from interface:PropertySerializerSerialize a property value.The
dataandpropertyNameparameters might not be used by different implementations, but allow for a single implementation to serialize more than one property of an object in different ways, if desired.- Specified by:
serializein interfacePropertySerializer- Parameters:
data- the source data being serialized, i.e. a JavaBeanpropertyName- the name of the property being serializedpropertyValue- the value of the property to serialize- Returns:
- the serialized value of the property
-