@Target(value=FIELD)
@Retention(value=RUNTIME)
@Documented
public @interface CosemAttribute
DataObject
can be
annotated with this annotation.
@To intercept read or write accesses of the attribute, a public get/set method must be provided. The get method must have get as a prefix and the set method respectively a set as a prefix.CosemClass
(id = 99, version = 2) public class DemoClass extends CosemInterfaceObject { @CosemAttribute
(id = 2) privateDataObject
data; ... }
The set and get methods may only throw an IllegalAttributeAccessException
.
@CosemClass
(id = 99, version = 2) public class DemoClass extends CosemInterfaceObject { @CosemAttribute
(id = 2, type = Type.INTEGER) privateDataObject
data; ... public void setData(DataObject newData) throwsIllegalAttributeAccessException
{ Number value = newData.getValue(); if (value.intValue() < 10) { throw new IllegalAttributeAccessException(AccessResultCode.TYPE_UNMATCHED); } this.data = newData; } }
NOTE: Ambiguous attribute ID's in a class are not allowed. Attribute ID 1 is reserved for the system.
Modifier and Type | Required Element and Description |
---|---|
byte |
id
The attribute ID.
|
Modifier and Type | Optional Element and Description |
---|---|
AttributeAccessMode |
accessMode
The access restriction for the attribute in a COSEM class.
|
int[] |
selector
Attribute sector ID's in a value range 0 to 255.
|
DataObject.Type |
type
The data type of the attribute.
|
public abstract byte id
public abstract AttributeAccessMode accessMode
NOTE: This attribute is optional.
public abstract DataObject.Type type
public abstract int[] selector
NOTE: get and set methods with SelectiveAccessDescription
s for the attribute must be provided.
SelectiveAccessDescription