public class DateTimeRepositoryElementType extends AbstractDateTimeElementType implements RepositoryElementType<ZonedDateTime>
Constructor and Description |
---|
DateTimeRepositoryElementType() |
Modifier and Type | Method and Description |
---|---|
private Calendar |
_getCalendarFromZonedDateTime(ZonedDateTime zonedDateTime) |
private ZonedDateTime |
_getZonedDateTimeFromCalendar(Calendar calendar) |
boolean |
isCompatible(RepositoryData parentData,
String name)
Checks if the value in the given repository data is compatible with the item type
|
Object |
read(RepositoryData parentData,
String name)
Read the value in the given repository data
|
void |
write(ModifiableRepositoryData parentData,
String name,
Object value)
Write the value into the given repository data
|
_singleValueToJSON, castValue, fromJSONForClient, isSimple, toString
_singleValueToSAX, getManagedClass, getManagedClassArray, isCompatible, parseConfiguration, valueToJSONForClient, valueToSAX
getId, setPluginInfo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
castValue, fromJSONForClient, getManagedClass, getManagedClassArray, isCompatible, isSimple, parseConfiguration, toString, valueToJSONForClient
getId, valueToSAX
setPluginInfo
public DateTimeRepositoryElementType()
public Object read(RepositoryData parentData, String name) throws BadItemTypeException
ZonedDateTime
.
To convert a ZonedDateTime
in Date
and keep the TimeZone
information, use the ChronoZonedDateTime.toEpochSecond()
method.read
in interface RepositoryElementType<ZonedDateTime>
parentData
- repository data containing the valuename
- the name of the element to readBadItemTypeException
- if the reading value doesn't match this element typeprivate ZonedDateTime _getZonedDateTimeFromCalendar(Calendar calendar)
public void write(ModifiableRepositoryData parentData, String name, Object value) throws BadItemTypeException
RepositoryElementType
write
in interface RepositoryElementType<ZonedDateTime>
parentData
- repository where to store the value.name
- the name of the element to writevalue
- the value to write. Can be a T or a T[]. That's why it is an ObjectBadItemTypeException
- If the given value doesn't match this element typeprivate Calendar _getCalendarFromZonedDateTime(ZonedDateTime zonedDateTime)
public boolean isCompatible(RepositoryData parentData, String name) throws UnknownDataException
RepositoryModelItemType
isCompatible
in interface RepositoryModelItemType
parentData
- repository data containing the data to checkname
- the name of the data to checktrue
if the data type matches the current type, false
otherwiseUnknownDataException
- if there is no data in the parent repository data with this name