1. Project Clover database Mon Dec 22 2025 14:59:38 CST
  2. Package org.europa.together.business

File JsonTools.java

 

Code metrics

0
0
0
1
63
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 case of
30    * error
31    */
32    @API(status = STABLE, since = "3.0")
33    String serializeAsJsonObject(T object)
34    throws JsonProcessingException;
35   
36    /**
37    * Create (deserialize) a DomainObject &gt;T&lt; from a JSON String.
38    *
39    * @param json as String
40    * @param object as &gt;T&lt;
41    * @return DomainObject as &gt;T&lt;
42    * @throws org.europa.together.exceptions.JsonProcessingException case of
43    * error
44    * @throws java.lang.ClassNotFoundException case of error
45    */
46    @API(status = STABLE, since = "3.0")
47    T deserializeJsonAsObject(String json, Class<T> object)
48    throws JsonProcessingException, ClassNotFoundException;
49   
50    /**
51    * Create (deserialize) a list of DomainObject &gt;T&lt; from a JSON String.
52    *
53    * @param json as String
54    * @return List of DomainObjects as &gt;T&lt;
55    * @throws org.europa.together.exceptions.JsonProcessingException case of
56    * error
57    * @throws java.lang.ClassNotFoundException case of error
58    */
59    @API(status = STABLE, since = "3.0")
60    List<T> deserializeJsonAsList(String json)
61    throws JsonProcessingException, ClassNotFoundException;
62   
63    }