Class SerializerBuilder

    • Constructor Detail

      • SerializerBuilder

        public SerializerBuilder()
      • SerializerBuilder

        public SerializerBuilder​(String name)
    • Method Detail

      • withRegistrationRequired

        public SerializerBuilder withRegistrationRequired()
        Requires explicit serializable type registration for serializable types.
        Returns:
        the serializer builder
      • withRegistrationRequired

        public SerializerBuilder withRegistrationRequired​(boolean registrationRequired)
        Sets whether serializable type registration is required for serializable types.
        Parameters:
        registrationRequired - whether serializable type registration is required for serializable types
        Returns:
        the serializer builder
      • withCompatibleSerialization

        public SerializerBuilder withCompatibleSerialization()
        Enables compatible serialization for serializable types.
        Returns:
        the serializer builder
      • withCompatibleSerialization

        public SerializerBuilder withCompatibleSerialization​(boolean compatibleSerialization)
        Sets whether compatible serialization is enabled for serializable types.
        Parameters:
        compatibleSerialization - whether compatible serialization is enabled for user types
        Returns:
        the serializer builder
      • withNamespace

        public SerializerBuilder withNamespace​(NamespaceImpl namespace)
        Adds a namespace to the serializer.
        Parameters:
        namespace - the namespace to add
        Returns:
        the serializer builder
      • withTypes

        public SerializerBuilder withTypes​(Class<?>... types)
        Sets the serializable types.
        Parameters:
        types - the types to register
        Returns:
        the serializer builder
      • addType

        public SerializerBuilder addType​(Class<?> type)
        Adds a serializable type to the builder.
        Parameters:
        type - the type to add
        Returns:
        the serializer builder
      • addSerializer

        public SerializerBuilder addSerializer​(com.esotericsoftware.kryo.Serializer serializer,
                                               Class<?>... types)
        Adds a serializer to the builder.
        Parameters:
        serializer - the serializer to add
        types - the serializable types
        Returns:
        the serializer builder
      • build

        public Serializer build()
        Description copied from interface: Builder
        Builds the object.

        The returned object may be a new instance of the built class or a recycled instance, depending on the semantics of the builder implementation. Users should never assume that a builder allocates a new instance.

        Specified by:
        build in interface Builder<Serializer>
        Returns:
        The built object.