com.cumulocity.model.event
Class AlarmStatusConverter
java.lang.Object
com.cumulocity.model.event.AlarmStatusConverter
- All Implemented Interfaces:
- org.svenson.converter.TypeConverter
public class AlarmStatusConverter
- extends Object
- implements org.svenson.converter.TypeConverter
Converts event statuses to and from JSON.
When converting to JSON the class name will be included in the value using the
core model extensibility naming rules unless the instance is of type CumulocityAlarmStatuses
or the status in which case just the value is written. For example:
com.othercorp.statuses.SOMESTATUS => "com_othercorp_statuses.SOMESTATUS"
com.cumulocity.model.event.CumulocityAlarmStatuses.ACTIVE => "ACTIVE"
When converting from JSON the converter will look for a type using the core model extensibility
naming convention. If the type is found then an instance of that class is returned, if there is no
type but the name is one of the CumulocityAlarmStatuses then an instance of CumulocityAlarmStatuses is
returned, otherwise an instance of com.cumulocity.model.event.AlarmStatusImpl is returned. For example:
"com_othercorp_statuses.SOMESTATUS" => com.othercorp.statuses.SOMESTATUS (assuming com.othercorp.statuses is known)
"ACTIVE" => com.cumulocity.model.event.CumulocityAlarmStatuses.ACTIVE
"SOMESTATUS" => com.cumulocity.model.event.AlarmStatusImpl
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AlarmStatusConverter
public AlarmStatusConverter()
fromJSON
public Object fromJSON(Object in)
- Specified by:
fromJSON
in interface org.svenson.converter.TypeConverter
toJSON
public Object toJSON(Object in)
- Converts AlarmStatus to JSON. If the passed object is one of the CumulocityAlarmStatuses then simply the
name is returned, otherwise the class name is converted using the extensibility naming convention, for example:
com.cumulocity.model.event.CumulocityAlarmStatuses.ACTIVE => "ACTIVE"
com.othercorp.enums.ENUM => "com_othercorp_enums.ENUM"
- Specified by:
toJSON
in interface org.svenson.converter.TypeConverter
Copyright © 2013 (C) Cumulocity GmbH. All Rights Reserved.