public interface ChannelAccessEnum extends ChannelAccessGettableValue<java.lang.Short>
Channel Access value that stores enum states. In its internal representation, an enum is just an unsigned short integer. However, it is interpreted as a discrete state.
Due to technical limitations of the Java platform, the enum states are represented by signed integers. The Channel Access protocol, however, defines them as unsigned. Therefore, positive numbers in the Channel Access protocol might appear as negative numbers in this library and vice-versa.
This interface should not be implemented by user-defined classes. Code that
wants to create an instance implementing this interface should use the
methods provided by ChannelAccessValueFactory
instead.
Modifier and Type | Method and Description |
---|---|
ChannelAccessEnum |
asReadOnlyValue()
Returns a read-only version of this value.
|
ChannelAccessEnum |
clone()
Creates and returns a copy of this object.
|
java.nio.ShortBuffer |
getValue()
Returns the buffer that stores the actual value elements.
|
void |
setValue(short[] value)
Replaces the buffer that stores the value's actual elements with a buffer
wrapping the passed array.
|
equals, getGenericValueElement, getType, getValueSize, hashCode, isReadOnly, iterator, toString
java.nio.ShortBuffer getValue()
Returns the buffer that stores the actual value elements.
The buffer returned is guaranteed to have a position of zero and a capacity and remaining elements equal to the number of elements in this value. In addition to that, the length of the array backing this buffer is equal to the buffer's capacity.
If this value is not read-only, the returned buffer's content can be modified and this modifications will directly affect this value and vice versa. Therefore, the buffer may not be modified after this value has been passed to a different component.
If this value is read-only, the returned buffer is also read-only.
null
).void setValue(short[] value)
Replaces the buffer that stores the value's actual elements with a buffer wrapping the passed array.
The buffer is backed by the passed array. This means that modifications of the array result in modifications of this value's elements and vice-versa.
The array passed to this method must not be changed after this value has been passed to another component, because changes to the array's content will affect this value's elements.
value
- array that replaces this value's elements.java.lang.UnsupportedOperationException
- if this value is read-only (ChannelAccessValue.isReadOnly()
returns
true
).ChannelAccessEnum asReadOnlyValue()
Returns a read-only version of this value. If the value is read-only, this value is returned. Otherwise, a wrapped version of this value, that does not allow modifications is returned.
Please note that the read-only value is not a copy of this value, but just a wrapper around it. This means, that modifications of the wrapped value will result in modifications of the read-only value. Therefore it is bad practice to modify a value that has been used as the base for a read-only value, because code that still has a reference to the read-only value might not expect this change and thus fail unexpectedly.
asReadOnlyValue
in interface ChannelAccessGettableValue<java.lang.Short>
asReadOnlyValue
in interface ChannelAccessValue<java.lang.Short>
null
).ChannelAccessEnum clone()
Creates and returns a copy of this object. The object returned is completely independent from this object. This means that modifications to this object will not affect the returned object and vice-versa.
The object returned is guaranteed to be completely identical to this
object, including its type. This means that
x.clone().equals(x)
and
x.clone().getClass() == x.getClass()
are always
true
.
The returned value is guaranteed to allow write access, even if this value is read-only. This means that cloning a read-only value is a good way to get a writable copy.
clone
in interface ChannelAccessGettableValue<java.lang.Short>
clone
in interface ChannelAccessValue<java.lang.Short>
Copyright © 2014–2019 aquenos GmbH. All rights reserved.