public static final class MMIODeviceConfig.Builder
extends java.lang.Object
Builder
class allows for creating and initializing
MMIODeviceConfig
objects. Calls can be chained in the following
manner:
MMIODeviceConfig config = new MMIODeviceConfig.Builder() .setControllerNumber(1) .setAddress(0x0000FFFF) .setSize(64) .setByteOrder(ByteOrder.LITTLE_ENDIAN) .setRawMemoryConfigs( new MMIODeviceConfig.RawRegisterConfig<>(0x00, "Seconds", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x01, "SecAlarm", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x02, "Minutes", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x03, "MinAlarm", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x04, "Hours", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x05, "HrAlarm", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x06, "DayOfWk", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x07, "DayOfMo", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x08, "Month", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x09, "Year", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x0A, "RegisterA", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x0B, "RegisterB", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x0C, "RegisterC", Byte.class), new MMIODeviceConfig.RawRegisterConfig<>(0x0D, "RegisterD", Byte.class), new MMIODeviceConfig.RawBlockConfig(0x0E, "UserRam", 50))) .build();
Constructor and Description |
---|
MMIODeviceConfig.Builder()
Creates a new
Builder instance. |
Modifier and Type | Method and Description |
---|---|
MMIODeviceConfig |
build()
Creates a new
MMIODeviceConfig instance initialized with the
values set for each configuration parameters. |
MMIODeviceConfig.Builder |
setAddress(long address)
Sets the base memory address of the device.
|
MMIODeviceConfig.Builder |
setByteOrder(java.nio.ByteOrder byteOrder)
Sets the byte order of the device (default value, if not set, is
the native byte order of the underlying platform as returned by
ByteOrder.nativeOrder() ). |
MMIODeviceConfig.Builder |
setControllerName(java.lang.String controllerName)
Sets the controller name (default value is
null if not set). |
MMIODeviceConfig.Builder |
setControllerNumber(int controllerNumber)
Sets the controller number (default value is
UNASSIGNED if
not set). |
MMIODeviceConfig.Builder |
setRawMemoryConfigs(MMIODeviceConfig.RawMemoryConfig... memConfigs)
Sets the raw block and raw register configurations (default value is
null if not set). |
MMIODeviceConfig.Builder |
setSize(int size)
Sets the size of the memory-mapped area of the device (a positive
integer).
|
public MMIODeviceConfig.Builder()
Builder
instance.public MMIODeviceConfig build()
MMIODeviceConfig
instance initialized with the
values set for each configuration parameters. If a configuration
parameter was not explictly set its default value will be used.MMIODeviceConfig
instance.java.lang.IndexOutOfBoundsException
- if any of the following is true:
Long.MAX_VALUE
- address
), where
address
is the base address of the device,memConfigs
elements is pointing outside of the defined address range ([
0
- (size - 1)
]), where size
is the size of the memory-mapped area.java.lang.IllegalStateException
- if any of the following is true:
public MMIODeviceConfig.Builder setControllerName(java.lang.String controllerName)
null
if not set).controllerName
- the controller name (such as its device
file name on UNIX systems) or null
.Builder
instance.public MMIODeviceConfig.Builder setAddress(long address)
address
- the memory address of the device (a positive or zero
integer).Builder
instance.java.lang.IllegalArgumentException
- if address
is not in the
defined range.public MMIODeviceConfig.Builder setControllerNumber(int controllerNumber)
UNASSIGNED
if
not set).controllerNumber
- the hardware converter's number (a positive
or zero integer) or UNASSIGNED
.Builder
instance.java.lang.IllegalArgumentException
- if controllerNumber
is not
in the defined range.public MMIODeviceConfig.Builder setSize(int size)
size
- the size of the memory-mapped area of the device (a
positive integer).Builder
instance.java.lang.IllegalArgumentException
- if size
is not in the
defined range.public MMIODeviceConfig.Builder setByteOrder(java.nio.ByteOrder byteOrder)
ByteOrder.nativeOrder()
).byteOrder
- the byte order of the device.Builder
instance.java.lang.NullPointerException
- if byteOrder
is null
.public MMIODeviceConfig.Builder setRawMemoryConfigs(MMIODeviceConfig.RawMemoryConfig... memConfigs)
null
if not set).memConfigs
- the raw block and raw register configurations (may
be null
or empty).Builder
instance.java.lang.NullPointerException
- if any component of the (non-null, non-empty)
memConfigs
array is null
.Copyright © 2012, 2015, Oracle and/or its affiliates. All rights reserved.
Legal Notices