Class DeviceJsonUtils<T extends DeviceSettings>


  • public class DeviceJsonUtils<T extends DeviceSettings>
    extends Object
    Utility functions for ease of conversion between generic DeviceSettings objects and Json representations of those objects.
    Since:
    13.0.0
    • Constructor Detail

      • DeviceJsonUtils

        public DeviceJsonUtils​(Class<T> classType)
        Constructs a new DeviceJsonUtils which will handle device settings of class supplied as the classType param.
        Parameters:
        classType - The class this DeviceJsonUtils instance will handle.
    • Method Detail

      • toJsonValue

        public org.forgerock.json.JsonValue toJsonValue​(T deviceSetting)
                                                 throws IOException
        Converts an DeviceSettings object to a JsonValue object which represents it.
        Parameters:
        deviceSetting - The DeviceSettings to convert.
        Returns:
        The JsonValue object.
        Throws:
        IOException - if the DeviceSettings object could not be converted to a JsonValue object
      • toDeviceSettingValue

        public T toDeviceSettingValue​(org.forgerock.json.JsonValue jsonValue)
                               throws IOException
        Converts a JsonValue object to the DeviceSettings object which it represents.
        Parameters:
        jsonValue - The JsonValue to convert.
        Returns:
        The DeviceSettings object.
        Throws:
        IOException - if the JsonValue object could not be converted to an DeviceSettings object
      • toJsonValues

        public List<org.forgerock.json.JsonValue> toJsonValues​(List<T> deviceSettings)
                                                        throws IOException
        Converts a List of DeviceSettings objects to a List of JsonValue objects which represents it.
        Parameters:
        deviceSettings - The List of DeviceSettings to convert.
        Returns:
        The List of JsonValue objects.
        Throws:
        IOException - if any DeviceSettings object could not be converted to a JsonValue object
      • toDeviceSettingValues

        public List<T> toDeviceSettingValues​(List<org.forgerock.json.JsonValue> jsonValues)
                                      throws IOException
        Converts a List of JsonValue objects to the List of DeviceSettings objects which it represents.
        Parameters:
        jsonValues - The List of JsonValue to convert.
        Returns:
        The List of DeviceSettings objects.
        Throws:
        IOException - if any JsonValue object could not be converted to an DeviceSettings object