Interface Serializer

All Superinterfaces:
Comparable<Serializer>, JolokiaService<Serializer>

public interface Serializer extends JolokiaService<Serializer>
Interface defining a Jolokia serializer which is also a plugable service. This interface is still connected to json-simple, but this dependency might be removed in the future.
Since:
02.10.13
Author:
roland
  • Method Details

    • serialize

      Object serialize(Object pValue, List<String> pPathParts, SerializeOptions pOptions) throws AttributeNotFoundException
      Convert the return value to a JSON object.
      Parameters:
      pValue - the value to convert
      pPathParts - path parts to use for extraction
      pOptions - options used for parsing
      Returns:
      the converter object. This either a subclass of JSONAware or a basic data type like String or Long.
      Throws:
      AttributeNotFoundException - if within an path an attribute could not be found
    • deserialize

      Object deserialize(String pExpectedClassName, Object pValue)
      Convert value from a either a given object or its string representation. If the value is already assignable to the given class name it is returned directly.
      Parameters:
      pExpectedClassName - type name of the expected type
      pValue - value to either take directly or to convert from its string representation.
      Returns:
      the converted object which is of type pExpectedClassName
    • setInnerValue

      Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts) throws AttributeNotFoundException, IllegalAccessException, InvocationTargetException
      Set an inner value of a complex object. A given path must point to the attribute/index to set within the outer object.
      Parameters:
      pOuterObject - the object to dive in
      pNewValue - the value to set
      pPathParts - the path within the outer object. This object will be modified and must be a modifiable list.
      Returns:
      the old value
      Throws:
      AttributeNotFoundException
      IllegalAccessException
      InvocationTargetException
    • deserializeOpenType

      Object deserializeOpenType(OpenType<?> pOpenType, Object pValue)
      Handle conversion for OpenTypes. The value is expected to be in JSON (either an JSONAware object or its string representation.
      Parameters:
      pOpenType - target type
      pValue - value to convert from
      Returns:
      the converted value