Package com.diozero.sbc
Class DeviceFactoryHelper
java.lang.Object
com.diozero.sbc.DeviceFactoryHelper
public class DeviceFactoryHelper extends Object
Helper class for automatically detecting the
native device factory
that will be used
for provisioning I/O devices. Uses the Java
ServiceLoader
to detect
NativeDeviceFactoryInterface implementations that are available on the
class-path as defined in
META-INF/services/com.diozero.internal.provider.NativeDeviceFactoryInterface
.
The first entry is used if there are multiple implementations present on the
class-path. Alternatively you can specify the class to use via the command
line or environment property diozero.devicefactory
. The
built-in
device factory
is used if the above logic fails to instantiate a device
factory implementation.-
Field Summary
Fields Modifier and Type Field Description static String
DEVICE_FACTORY_PROP
-
Constructor Summary
Constructors Constructor Description DeviceFactoryHelper()
-
Method Summary
Modifier and Type Method Description static NativeDeviceFactoryInterface
getNativeDeviceFactory()
Auto-detect the native device factory class to be used for provisioning I/O devices in this lookup order: Command lineproperty / environment
variablediozero.devicefactory
JavaServiceLoader
using the classcom.diozero.internal.provider.NativeDeviceFactoryInterface
Thebuilt-in device factory
-
Field Details
-
DEVICE_FACTORY_PROP
- See Also:
- Constant Field Values
-
-
Constructor Details
-
DeviceFactoryHelper
public DeviceFactoryHelper()
-
-
Method Details
-
getNativeDeviceFactory
Auto-detect the native device factory class to be used for provisioning I/O devices in this lookup order:- Command line
property / environment
variablediozero.devicefactory
- Java
ServiceLoader
using the classcom.diozero.internal.provider.NativeDeviceFactoryInterface
- The
built-in device factory
- Returns:
- the native device factory instance to use for provisioning I/O devices.
- Command line
-