1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.business

File JsonTools.java

 

Code metrics

0
0
0
1
60
21
0
-
-
0
-

Classes

Class Line # Actions
JsonTools 16 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.europa.together.business;
2   
3    import org.europa.together.exceptions.JsonProcessingException;
4    import java.util.List;
5    import org.apiguardian.api.API;
6    import static org.apiguardian.api.API.Status.STABLE;
7    import org.springframework.stereotype.Component;
8   
9    /**
10    * Lightweight wrapper for basic JSON functionality.
11    *
12    * @param <T> as DomainObject
13    */
14    @API(status = STABLE, since = "3.0", consumers = "JacksonJsonTools")
15    @Component
 
16    public interface JsonTools<T> {
17   
18    /**
19    * Identifier for the given feature.
20    */
21    @API(status = STABLE, since = "3.0")
22    String FEATURE_ID = "CM-15";
23   
24    /**
25    * Serialize an DomainObject &gt;T&lt; to an JSON String.
26    *
27    * @param object as &gt;T&lt; DomainObject
28    * @return JSON as String
29    * @throws org.europa.together.exceptions.JsonProcessingException
30    */
31    @API(status = STABLE, since = "3.0")
32    String serializeAsJsonObject(T object)
33    throws JsonProcessingException;
34   
35    /**
36    * Create (deserialize) a DomainObject &gt;T&lt; from a JSON String.
37    *
38    * @param json as String
39    * @param object as &gt;T&lt;
40    * @return DomainObject as &gt;T&lt;
41    * @throws org.europa.together.exceptions.JsonProcessingException
42    * @throws java.lang.ClassNotFoundException
43    */
44    @API(status = STABLE, since = "3.0")
45    T deserializeJsonAsObject(String json, Class<T> object)
46    throws JsonProcessingException, ClassNotFoundException;
47   
48    /**
49    * Create (deserialize) a list of DomainObject &gt;T&lt; from a JSON String.
50    *
51    * @param json as String
52    * @return List of DomainObjects as &gt;T&lt;
53    * @throws org.europa.together.exceptions.JsonProcessingException
54    * @throws java.lang.ClassNotFoundException
55    */
56    @API(status = STABLE, since = "3.0")
57    List<T> deserializeJsonAsList(String json)
58    throws JsonProcessingException, ClassNotFoundException;
59   
60    }