类 ServiceLoaderUtils
- java.lang.Object
-
- io.microsphere.util.BaseUtils
-
- io.microsphere.util.ServiceLoaderUtils
-
-
构造器概要
构造器 构造器 说明 ServiceLoaderUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <S> java.util.ServiceLoader<S>
load(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
static <S> S
loadFirstService(java.lang.Class<S> serviceType)
Load the first instance ofService interface instances list
static <S> S
loadFirstService(java.lang.Class<S> serviceType, boolean cached)
Load the first instance ofService interface instances list
static <S> S
loadFirstService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader)
Load the first instance ofService interface instances list
static <S> S
loadFirstService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
Load the first instance ofService interface instances list
static <S> S
loadLastService(java.lang.Class<S> serviceType)
Loads the last in the list of objects implementing the service type, if present.static <S> S
loadLastService(java.lang.Class<S> serviceType, boolean cached)
Loads the last in the list of objects implementing the service type, if present.static <S> S
loadLastService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader)
Loads the last in the list of objects implementing the service type, if present.static <S> S
loadLastService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
Loads the last in the list of objects implementing the service type, if present.static <S> S[]
loadServices(java.lang.Class<S> serviceType)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> S[]
loadServices(java.lang.Class<S> serviceType, boolean cached)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> S[]
loadServices(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> S[]
loadServices(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> java.util.List<S>
loadServicesList(java.lang.Class<S> serviceType)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> java.util.List<S>
loadServicesList(java.lang.Class<S> serviceType, boolean cached)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> java.util.List<S>
loadServicesList(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
static <S> java.util.List<S>
loadServicesList(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path.
-
-
-
方法详细资料
-
loadServicesList
public static <S> java.util.List<S> loadServicesList(java.lang.Class<S> serviceType) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- service type all implementation objects of
readonly list
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServicesList
public static <S> java.util.List<S> loadServicesList(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typeclassLoader
-ClassLoader
- 返回:
- service type all implementation objects of
readonly list
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServicesList
public static <S> java.util.List<S> loadServicesList(java.lang.Class<S> serviceType, boolean cached) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typecached
- the list of services to be cached- 返回:
- service type all implementation objects of
readonly list
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServicesList
public static <S> java.util.List<S> loadServicesList(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typeclassLoader
-ClassLoader
cached
- the list of services to be cached- 返回:
- service type all implementation objects of
readonly list
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServices
public static <S> S[] loadServices(java.lang.Class<S> serviceType) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- service type all implementation objects
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServices
public static <S> S[] loadServices(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typeclassLoader
-ClassLoader
- 返回:
- service type all implementation objects
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServices
public static <S> S[] loadServices(java.lang.Class<S> serviceType, boolean cached) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typecached
- the list of services to be cached- 返回:
- service type all implementation objects
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadServices
public static <S> S[] loadServices(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached) throws java.lang.IllegalArgumentException
Using the hierarchy ofClassLoader
, each level of ClassLoader ( ClassLoader , its parent ClassLoader and higher) will be able to load the configuration file META-INF/servicesserviceType
under its class path. The configuration file of each service type can define multiple lists of implementation classes.
- 类型参数:
S
- service type- 参数:
serviceType
- service typeclassLoader
-ClassLoader
cached
- the list of services to be cached- 返回:
- service type all implementation objects
- 抛出:
java.lang.IllegalArgumentException
- If it refers to the implementation class that does not defineserviceType
in the configuration file /META-INF/services/
serviceType
-
loadFirstService
public static <S> S loadFirstService(java.lang.Class<S> serviceType) throws java.lang.IllegalArgumentException
Load the first instance ofService interface instances list
Design Purpose : Using the hierarchy ofClassLoader
, each level of ClassLoader will be able to access the configuration files under its class path /META-INF/services/serviceType
. Then, override the first implementation class of the configuration file under the class path of ClassLoader, thereby providing a mechanism for overriding the implementation class.- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- If it exists,
loads the first in the list of implementation objects of service type
. - 抛出:
java.lang.IllegalArgumentException
- If the implementation class that does not defineserviceType
is in the configuration file META-INF/services/
serviceType
, IllegalArgumentException will be thrown
-
loadFirstService
public static <S> S loadFirstService(java.lang.Class<S> serviceType, boolean cached) throws java.lang.IllegalArgumentException
Load the first instance ofService interface instances list
Design Purpose : Using the hierarchy ofClassLoader
, each level of ClassLoader will be able to access the configuration files under its class path /META-INF/services/serviceType
. Then, override the first implementation class of the configuration file under the class path of ClassLoader, thereby providing a mechanism for overriding the implementation class.- 类型参数:
S
- service type- 参数:
serviceType
- service typecached
- the list of services to be cached- 返回:
- If it exists,
loads the first in the list of implementation objects of service type
. - 抛出:
java.lang.IllegalArgumentException
- If the implementation class that does not defineserviceType
is in the configuration file META-INF/services/
serviceType
, IllegalArgumentException will be thrown
-
loadFirstService
public static <S> S loadFirstService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
Load the first instance ofService interface instances list
Design Purpose : Using the hierarchy ofClassLoader
, each level of ClassLoader will be able to access the configuration files under its class path /META-INF/services/serviceType
. Then, override the first implementation class of the configuration file under the class path of ClassLoader, thereby providing a mechanism for overriding the implementation class.- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- If it exists,
loads the first in the list of implementation objects of service type
. - 抛出:
java.lang.IllegalArgumentException
- If the implementation class that does not defineserviceType
is in the configuration file META-INF/services/
serviceType
, IllegalArgumentException will be thrown
-
loadFirstService
public static <S> S loadFirstService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached) throws java.lang.IllegalArgumentException
Load the first instance ofService interface instances list
Design Purpose : Using the hierarchy ofClassLoader
, each level of ClassLoader will be able to access the configuration files under its class path /META-INF/services/serviceType
. Then, override the first implementation class of the configuration file under the class path of ClassLoader, thereby providing a mechanism for overriding the implementation class.- 类型参数:
S
- service type- 参数:
serviceType
- service typecached
- the list of services to be cached- 返回:
- If it exists,
loads the first in the list of implementation objects of service type
. - 抛出:
java.lang.IllegalArgumentException
- If the implementation class that does not defineserviceType
is in the configuration file META-INF/services/
serviceType
, IllegalArgumentException will be thrown
-
loadLastService
public static <S> S loadLastService(java.lang.Class<S> serviceType) throws java.lang.IllegalArgumentException
Loads the last in the list of objects implementing the service type, if present. Design Purpose : Using the hierarchy ofClassLoader
, once the configuration file is loaded in the parent's ClassLoader at a higher level (here the highest-level ClassLoader is Bootstrap ClassLoader) /META-INF/services/serviceType
If the last implementation class is used, the lower-level Class Loader will not be able to override the previous definition。- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- Loads the last in the list of objects implementing the service type, if present.
- 抛出:
java.lang.IllegalArgumentException
- seeloadServicesList(Class, ClassLoader)
-
loadLastService
public static <S> S loadLastService(java.lang.Class<S> serviceType, boolean cached) throws java.lang.IllegalArgumentException
Loads the last in the list of objects implementing the service type, if present. Design Purpose : Using the hierarchy ofClassLoader
, once the configuration file is loaded in the parent's ClassLoader at a higher level (here the highest-level ClassLoader is Bootstrap ClassLoader) /META-INF/services/serviceType
If the last implementation class is used, the lower-level Class Loader will not be able to override the previous definition。- 类型参数:
S
- service type- 参数:
serviceType
- service typecached
- the list of services to be cached- 返回:
- Loads the last in the list of objects implementing the service type, if present.
- 抛出:
java.lang.IllegalArgumentException
- seeloadServicesList(Class, ClassLoader)
-
loadLastService
public static <S> S loadLastService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
Loads the last in the list of objects implementing the service type, if present. Design Purpose : Using the hierarchy ofClassLoader
, once the configuration file is loaded in the parent's ClassLoader at a higher level (here the highest-level ClassLoader is Bootstrap ClassLoader) /META-INF/services/serviceType
If the last implementation class is used, the lower-level Class Loader will not be able to override the previous definition。- 类型参数:
S
- service type- 参数:
serviceType
- service typeclassLoader
-ClassLoader
- 返回:
- Loads the last in the list of objects implementing the service type, if present.
- 抛出:
java.lang.IllegalArgumentException
- seeloadServicesList(Class, ClassLoader)
-
loadLastService
public static <S> S loadLastService(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached) throws java.lang.IllegalArgumentException
Loads the last in the list of objects implementing the service type, if present. Design Purpose : Using the hierarchy ofClassLoader
, once the configuration file is loaded in the parent's ClassLoader at a higher level (here the highest-level ClassLoader is Bootstrap ClassLoader) /META-INF/services/serviceType
If the last implementation class is used, the lower-level Class Loader will not be able to override the previous definition。- 类型参数:
S
- service type- 参数:
serviceType
- service type- 返回:
- Loads the last in the list of objects implementing the service type, if present.
- 抛出:
java.lang.IllegalArgumentException
- seeloadServicesList(Class, ClassLoader)
-
load
public static <S> java.util.ServiceLoader<S> load(java.lang.Class<S> serviceType, java.lang.ClassLoader classLoader, boolean cached)
-
-