Class DoclingServeClientBuilderFactory
- All Implemented Interfaces:
ai.docling.serve.api.spi.DoclingServeApiBuilderFactory
DoclingServeClient.DoclingServeClientBuilder.
This factory determines which version of Jackson (2 or 3) is available
on the application's classpath and provides a corresponding builder for
creating DoclingServeClient implementations.
If neither Jackson 2 nor Jackson 3 is present on the classpath, an
IllegalStateException is thrown.
The factory uses a type-safe generic method to support custom subclasses of
DoclingServeClient and DoclingServeClient.DoclingServeClientBuilder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends ai.docling.serve.api.DoclingServeApi,B extends ai.docling.serve.api.DoclingServeApi.DoclingApiBuilder<T, B>>
Bstatic <C extends DoclingServeClient,B extends DoclingServeClient.DoclingServeClientBuilder<C, B>>
BCreates and returns a new instance of aDoclingServeClient.DoclingServeClientBuilderthat is compatible with the version of Jackson available on the application's classpath.static <C extends DoclingServeClient,B extends DoclingServeClient.DoclingServeClientBuilder<C, B>>
BnewBuilder(ClassLoader classLoader) Creates and returns a new instance of aDoclingServeClient.DoclingServeClientBuildercompatible with the Jackson version present on the provided classloader's classpath.
-
Constructor Details
-
DoclingServeClientBuilderFactory
public DoclingServeClientBuilderFactory()
-
-
Method Details
-
newBuilder
public static <C extends DoclingServeClient,B extends DoclingServeClient.DoclingServeClientBuilder<C, B newBuilderB>> (ClassLoader classLoader) Creates and returns a new instance of aDoclingServeClient.DoclingServeClientBuildercompatible with the Jackson version present on the provided classloader's classpath.If Jackson 3 is detected, returns a builder for
DoclingServeJackson3Client. If Jackson 2 is detected, returns a builder forDoclingServeJackson2Client. If neither version of Jackson is found on the classpath, anIllegalStateExceptionis thrown.The method uses generics to support custom implementations of
DoclingServeClientandDoclingServeClient.DoclingServeClientBuilder.- Type Parameters:
C- the type ofDoclingServeClientto be created by the builderB- the type ofDoclingServeClient.DoclingServeClientBuilderto be returned- Parameters:
classLoader- theClassLoaderused to check for Jackson's presence- Returns:
- a compatible
DoclingServeClient.DoclingServeClientBuilderinstance - Throws:
IllegalStateException- if neither Jackson 2 nor Jackson 3 is available on the classpath
-
newBuilder
public static <C extends DoclingServeClient,B extends DoclingServeClient.DoclingServeClientBuilder<C, B newBuilder()B>> Creates and returns a new instance of aDoclingServeClient.DoclingServeClientBuilderthat is compatible with the version of Jackson available on the application's classpath.If Jackson 3 is found on the classpath, it returns a builder for
DoclingServeJackson3Client. If Jackson 2 is found, it returns a builder forDoclingServeJackson2Client. If neither are found, anIllegalStateExceptionis thrown.This method utilizes generics to support custom implementations of
DoclingServeClientandDoclingServeClient.DoclingServeClientBuilder.- Type Parameters:
C- the type ofDoclingServeClientto be created by the builderB- the type ofDoclingServeClient.DoclingServeClientBuilderto be returned- Returns:
- a compatible
DoclingServeClient.DoclingServeClientBuilderinstance - Throws:
IllegalStateException- if neither Jackson 2 nor Jackson 3 is available on the classpath
-
getBuilder
public <T extends ai.docling.serve.api.DoclingServeApi,B extends ai.docling.serve.api.DoclingServeApi.DoclingApiBuilder<T, B getBuilder()B>> - Specified by:
getBuilderin interfaceai.docling.serve.api.spi.DoclingServeApiBuilderFactory
-