Class AuthleteApiFactory
- java.lang.Object
-
- com.authlete.common.api.AuthleteApiFactory
-
public class AuthleteApiFactory extends Object
Factory to create anAuthleteApiinstance.- Author:
- Takahiko Kawasaki
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AuthleteApicreate(AuthleteConfiguration configuration)Create an instance ofAuthleteApi.static AuthleteApicreate(AuthleteConfiguration configuration, String className)Create an instance ofAuthleteApifrom the specified class.static AuthleteApigetDefaultApi()Get the default instance ofAuthleteApi.
-
-
-
Method Detail
-
create
public static AuthleteApi create(AuthleteConfiguration configuration)
Create an instance ofAuthleteApi.This method repeats to call
create(AuthleteConfiguration, String)until one of the known classes is successfully instantiated.The classes listed below are the ones that the current implementation knows for Authlete API V3.
com.authlete.jaxrs.api.AuthleteApiImplV3
(using JAX-RS 2.0 API, contained incom.authlete:authlete-java-jaxrs)com.authlete.jakarta.api.AuthleteApiImplV3
(using Jakarta REST client API, contained incom.authlete:authlete-java-jakarta)com.authlete.common.api.AuthleteApiImplV3
(usingHttpURLConnection, contained incom.authlete:authlete-java-common)
The classes listed below are the ones that the current implementation knows for Authlete API V2.
com.authlete.jaxrs.api.AuthleteApiImpl
(using JAX-RS 2.0 API, contained incom.authlete:authlete-java-jaxrs)com.authlete.common.api.AuthleteApiImpl
(usingHttpURLConnection, contained incom.authlete:authlete-java-commonsince version 2.0)
- Parameters:
configuration- Authlete configuration.- Returns:
- An instance of
AuthleteApi. If none of the known classes that implementAuthleteApiinterface was successfully instantiated,nullis returned.
-
create
public static AuthleteApi create(AuthleteConfiguration configuration, String className)
Create an instance ofAuthleteApifrom the specified class.- Parameters:
configuration- Authlete configuration.className- The name of a class that implementsAuthleteApiinterface. The class must have a constructor which takes one argument of typeAuthleteConfiguration.- Returns:
- An instance of the specified class.
- Throws:
IllegalArgumentException-configurationisnull.classNameisnull.- The specified class is not found.
- The specified class does not implement
AuthleteApiinterface. - The specified class does not have a constructor which takes one
argument of type
AuthleteConfiguration.
IllegalStateException- The constructor of the specified class threw an exception.
-
getDefaultApi
public static AuthleteApi getDefaultApi()
Get the default instance ofAuthleteApi.This method loads a configuration file (using
AuthletePropertiesConfiguration) on the first call, creates an instance ofAuthleteApiand caches the instance. The second and subsequent calls return the cached instance.The default name of the configuration file is
authlete.properties, but it can be changed by a system propertyauthlete.configuration.file. The current directory and the classpath are searched for the configuration file in this order.- Returns:
- An instance of
AuthleteApi. - Since:
- 1.29
-
-