Interface IJSONAdapter


public interface IJSONAdapter
Register OSGi services under this interface to enable adaptation of a object to a different object that is more suitable for usage in JSON
  • Method Details

    • adapt

      Object adapt(Object adaptableObject, IJSONAdapterFactory adapterFactory) throws Exception
      (Optionally) adapt the given object to another object that is more suitable for JSON
      Parameters:
      adaptableObject - the object to adapt
      adapterFactory - the factory to call in case parts of the adaptableObject require further adaptation
      Returns:
      the adapted object or null if this factory does not have an adapter for the given object
      Throws:
      Exception
    • getSchemaFields

      default Map<String,Object> getSchemaFields(Class<?> clazz, Map<String,Object> schemasMap, IJSONAdapterFactory adapterFactory, Map<String,Class<?>> usedSchemaNamesMap) throws Exception
      Get the schema type for the openapi
      Parameters:
      clazz - the type
      schemasMap - the map of already existing schemas
      adapterFactory - the factory to call in case parts of the adaptableObject require further adaptation
      usedSchemaNamesMap - map of already used schema names to ensure unique names
      Returns:
      the map of fields for the schema (typically contains "type" + "format" or "$ref" keys)
      Throws:
      Exception