Search in sources :

Example 21 with ComponentManager

use of org.talend.sdk.component.runtime.manager.ComponentManager in project component-runtime by Talend.

the class LoopState method toJsonObject.

private JsonObject toJsonObject(final Object value) {
    if (jsonb == null) {
        synchronized (this) {
            if (jsonb == null) {
                final ComponentManager manager = ComponentManager.instance();
                jsonb = manager.getJsonbProvider().create().withProvider(manager.getJsonpProvider()).withConfig(new JsonbConfig().setProperty("johnzon.cdi.activated", false)).build();
            }
        }
    }
    return jsonb.fromJson(jsonb.toJson(value), JsonObject.class);
}
Also used : JsonbConfig(javax.json.bind.JsonbConfig) ComponentManager(org.talend.sdk.component.runtime.manager.ComponentManager)

Aggregations

ComponentManager (org.talend.sdk.component.runtime.manager.ComponentManager)21 Test (org.junit.jupiter.api.Test)12 File (java.io.File)8 JsonObject (javax.json.JsonObject)8 List (java.util.List)7 Collectors.toList (java.util.stream.Collectors.toList)7 Collection (java.util.Collection)6 HashMap (java.util.HashMap)6 Jsonb (javax.json.bind.Jsonb)6 AllArgsConstructor (lombok.AllArgsConstructor)6 Data (lombok.Data)6 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)6 Serializable (java.io.Serializable)5 ArrayList (java.util.ArrayList)5 Collections.singletonMap (java.util.Collections.singletonMap)5 Map (java.util.Map)5 Optional (java.util.Optional)5 PrimitiveIterator (java.util.PrimitiveIterator)5 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)5 IntStream (java.util.stream.IntStream)5