T - Service interfacepublic final class ServiceLoader<T>
extends java.lang.Object
ServiceLoader.| Constructor | Description |
|---|---|
ServiceLoader(java.lang.Class<? extends T> service,
java.lang.Class<?>... argumentTypes) |
| Modifier and Type | Method | Description |
|---|---|---|
T |
create(java.lang.String name,
java.lang.Object... arguments) |
Creates a defined service implementation.
|
java.util.Collection<T> |
createAll(java.lang.Object... arguments) |
Creates all registered service implementations.
|
java.util.List<T> |
createList(java.lang.String list) |
Creates service implementations from a comma separated list of names.
|
java.lang.String |
toSimpleClassName(java.lang.String name) |
Generates the simple class name from an acronym.
|
public ServiceLoader(java.lang.Class<? extends T> service, java.lang.Class<?>... argumentTypes)
service - Service interfaceargumentTypes - Expected argument types for constructorspublic T create(java.lang.String name, java.lang.Object... arguments)
The acronym for org.tinylog.writers.RollingFileWriter is for example rolling file.
name - Acronym or class name of service implementationarguments - Arguments for constructor of service implementationnull if failed to create servicepublic java.util.List<T> createList(java.lang.String list)
list - Comma separated list of names with optional argumentspublic java.util.Collection<T> createAll(java.lang.Object... arguments)
arguments - Arguments for constructors of service implementationspublic java.lang.String toSimpleClassName(java.lang.String name)
The acronym rolling file, for example, will be transformed into RollingFileWriter for the service
interface Writer.
name - Simplified acronymCopyright © 2021. All rights reserved.