Package com.c8db

Class C8DB.Builder

    • Field Detail

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • host

        public C8DB.Builder host​(String host,
                                 int port)
        Adds a host to connect to. Multiple hosts can be added to provide fallbacks.
        Parameters:
        host - address of the host
        port - port of the host
        Returns:
        C8DB.Builder
      • timeout

        public C8DB.Builder timeout​(Integer timeout)
        Sets the connection and request timeout in milliseconds.
        Parameters:
        timeout - timeout in milliseconds
        Returns:
        C8DB.Builder
      • user

        public C8DB.Builder user​(String user)
        Sets the username to use for authentication.
        Parameters:
        user - the user in the database (default: root)
        Returns:
        C8DB.Builder
      • password

        public C8DB.Builder password​(String password)
        Sets the password for the user for authentication.
        Parameters:
        password - the password of the user in the database (default: null)
        Returns:
        C8DB.Builder
      • useSsl

        public C8DB.Builder useSsl​(Boolean useSsl)
        If set to true SSL will be used when connecting to an ArangoDB server.
        Parameters:
        useSsl - whether or not use SSL (default: false)
        Returns:
        C8DB.Builder
      • connectionTtl

        public C8DB.Builder connectionTtl​(Long connectionTtl)
        Set the maximum time to life of a connection. After this time the connection will be closed automatically.
        Parameters:
        connectionTtl - the maximum time to life of a connection in milliseconds
        Returns:
        C8DB.Builder
      • acquireHostList

        public C8DB.Builder acquireHostList​(Boolean acquireHostList)
        Whether or not the driver should acquire a list of available coordinators in an ArangoDB cluster or a single server with active failover.

        The host list will be used for failover and load balancing.

        Parameters:
        acquireHostList - whether or not automatically acquire a list of available hosts (default: false)
        Returns:
        C8DB.Builder
      • acquireHostListInterval

        public C8DB.Builder acquireHostListInterval​(Integer acquireHostListInterval)
        Setting the Interval for acquireHostList
        Parameters:
        acquireHostListInterval - Interval in Seconds
        Returns:
        C8DB.Builder
      • registerSerializer

        public <T> C8DB.Builder registerSerializer​(Class<T> clazz,
                                                   com.arangodb.velocypack.VPackSerializer<T> serializer)
        Register a custom VPackSerializer for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        clazz - the type the serializer should be registered for
        serializer - serializer to register
        Returns:
        C8DB.Builder
      • registerEnclosingSerializer

        public <T> C8DB.Builder registerEnclosingSerializer​(Class<T> clazz,
                                                            com.arangodb.velocypack.VPackSerializer<T> serializer)
        Register a special serializer for a member class which can only be identified by its enclosing class.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        clazz - the type of the enclosing class
        serializer - serializer to register
        Returns:
        C8DB.Builder
      • registerDeserializer

        public <T> C8DB.Builder registerDeserializer​(Class<T> clazz,
                                                     com.arangodb.velocypack.VPackDeserializer<T> deserializer)
        Register a custom VPackDeserializer for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        clazz - the type the serializer should be registered for
        deserializer -
        Returns:
        C8DB.Builder
      • registerInstanceCreator

        public <T> C8DB.Builder registerInstanceCreator​(Class<T> clazz,
                                                        com.arangodb.velocypack.VPackInstanceCreator<T> creator)
        Register a custom VPackInstanceCreator for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        clazz - the type the instance creator should be registered for
        creator -
        Returns:
        C8DB.Builder
      • registerJsonDeserializer

        public C8DB.Builder registerJsonDeserializer​(com.arangodb.velocypack.ValueType type,
                                                     com.arangodb.velocypack.VPackJsonDeserializer deserializer)
        Register a custom VPackJsonDeserializer for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        type - the type the serializer should be registered for
        deserializer -
        Returns:
        C8DB.Builder
      • registerJsonDeserializer

        public C8DB.Builder registerJsonDeserializer​(String attribute,
                                                     com.arangodb.velocypack.ValueType type,
                                                     com.arangodb.velocypack.VPackJsonDeserializer deserializer)
        Register a custom VPackJsonDeserializer for a specific type and attribute name to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        attribute -
        type - the type the serializer should be registered for
        deserializer -
        Returns:
        C8DB.Builder
      • registerJsonSerializer

        public <T> C8DB.Builder registerJsonSerializer​(Class<T> clazz,
                                                       com.arangodb.velocypack.VPackJsonSerializer<T> serializer)
        Register a custom VPackJsonSerializer for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        clazz - the type the serializer should be registered for
        serializer -
        Returns:
        C8DB.Builder
      • registerJsonSerializer

        public <T> C8DB.Builder registerJsonSerializer​(String attribute,
                                                       Class<T> clazz,
                                                       com.arangodb.velocypack.VPackJsonSerializer<T> serializer)
        Register a custom VPackJsonSerializer for a specific type and attribute name to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        attribute -
        clazz - the type the serializer should be registered for
        serializer -
        Returns:
        C8DB.Builder
      • annotationFieldFilter

        public <A extends AnnotationC8DB.Builder annotationFieldFilter​(Class<A> type,
                                                                         com.arangodb.velocypack.VPackAnnotationFieldFilter<A> fieldFilter)
        Register a custom VPackAnnotationFieldFilter for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        type - the type the serializer should be registered for
        fieldFilter -
        Returns:
        C8DB.Builder
      • annotationFieldNaming

        public <A extends AnnotationC8DB.Builder annotationFieldNaming​(Class<A> type,
                                                                         com.arangodb.velocypack.VPackAnnotationFieldNaming<A> fieldNaming)
        Register a custom VPackAnnotationFieldNaming for a specific type to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        type - the type the serializer should be registered for
        fieldNaming -
        Returns:
        C8DB.Builder
      • registerModule

        public C8DB.Builder registerModule​(com.arangodb.velocypack.VPackModule module)
        Register a VPackModule to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        module - module to register
        Returns:
        C8DB.Builder
      • registerModules

        public C8DB.Builder registerModules​(com.arangodb.velocypack.VPackModule... modules)
        Register a list of VPackModule to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        modules - modules to register
        Returns:
        C8DB.Builder
      • registerJsonModule

        public C8DB.Builder registerJsonModule​(com.arangodb.velocypack.VPackParserModule module)
        Register a VPackParserModule to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        module - module to register
        Returns:
        C8DB.Builder
      • registerJsonModules

        public C8DB.Builder registerJsonModules​(com.arangodb.velocypack.VPackParserModule... modules)
        Register a list of VPackParserModule to be used within the internal serialization process.

        Attention:can not be used together with serializer(C8Serialization)

        Parameters:
        modules - modules to register
        Returns:
        C8DB.Builder
      • serializer

        public C8DB.Builder serializer​(C8Serialization serialization)
        Replace the built-in serializer/deserializer with the given one.
        ATTENTION!: Any registered custom serializer/deserializer or module will be ignored.
        Parameters:
        serialization - custom serializer/deserializer
        Returns:
        C8DB.Builder
      • build

        public C8DB build()
        Returns an instance of C8DB.
        Returns:
        C8DB