1111 *   Contributors: 
1212 * 
1313 *   Otavio Santana 
14+  *   Michele Rastelli 
1415 */ 
1516package  org .eclipse .jnosql .databases .arangodb .communication ;
1617
1718
1819import  com .arangodb .ArangoDB ;
1920import  com .arangodb .entity .LoadBalancingStrategy ;
21+ import  com .arangodb .serde .ArangoSerde ;
2022import  org .eclipse .jnosql .communication .Settings ;
2123
2224import  static  java .util .Objects .requireNonNull ;
2325
2426/** 
25-  * The base to configuration both key-value and document on mongoDB . 
27+  * The base to configuration both key-value and document on ArangoDB . 
2628 * To each configuration set, it will change both builder 
2729 * {@link ArangoDB.Builder} 
2830 */ 
2931public  abstract  class  ArangoDBConfiguration  {
3032
31- 
32-     protected   ArangoDB . Builder   builder  =  new   ArangoDB . Builder ( );
33+      protected   ArangoDB . Builder   builder  =  new   ArangoDB . Builder () 
34+             . serde ( new   JsonbSerde () );
3335
3436    /** 
3537     * Adds a host in the arangodb builder 
@@ -54,7 +56,6 @@ public void setLoadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy
5456        builder .loadBalancingStrategy (loadBalancingStrategy );
5557    }
5658
57- 
5859    /** 
5960     * set the setTimeout 
6061     * 
@@ -91,6 +92,21 @@ public void setUseSSL(boolean value) {
9192        builder .useSsl (value );
9293    }
9394
95+     /** 
96+      * Set the ArangoDB serde for the user data. Note that the provided 
97+      * serde must support serializing and deserializing JsonP types, 
98+      * i.e. {@link jakarta.json.JsonValue} and its children. 
99+      * By default, the builder is configured to use {@link JsonbSerde}; 
100+      * this setter allows overriding it, i.e. providing an instance of 
101+      * {@link JsonbSerde} that uses a specific {@link jakarta.json.bind.Jsonb} 
102+      * instance. 
103+      * 
104+      * @param serde the serde 
105+      */ 
106+     public  void  setSerde (ArangoSerde  serde ) {
107+         builder .serde (serde );
108+     }
109+ 
94110    /** 
95111     * Defines a new builder to sync ArangoDB 
96112     * 
@@ -102,12 +118,10 @@ public void syncBuilder(ArangoDB.Builder builder) throws NullPointerException {
102118        this .builder  = builder ;
103119    }
104120
105- 
106121    protected  ArangoDB  getArangoDB (Settings  settings ) {
107122        ArangoDBBuilderSync  aragonDB  = new  ArangoDBBuilderSync (builder );
108123        ArangoDBBuilders .load (settings , aragonDB );
109124        return  aragonDB .build ();
110125    }
111126
112- 
113127}
0 commit comments