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 Summary
Modifier and TypeMethodDescriptionadapt
(Object adaptableObject, IJSONAdapterFactory adapterFactory) (Optionally) adapt the given object to another object that is more suitable for JSONgetSchemaFields
(Class<?> clazz, Map<String, Object> schemasMap, IJSONAdapterFactory adapterFactory, Map<String, Class<?>> usedSchemaNamesMap) Get the schema type for the openapi
-
Method Details
-
adapt
(Optionally) adapt the given object to another object that is more suitable for JSON- Parameters:
adaptableObject
- the object to adaptadapterFactory
- 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, throws ExceptionClass<?>> usedSchemaNamesMap) Get the schema type for the openapi- Parameters:
clazz
- the typeschemasMap
- the map of already existing schemasadapterFactory
- the factory to call in case parts of the adaptableObject require further adaptationusedSchemaNamesMap
- 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
-