@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 or set method must be provided. The get/set method must only contain the field name.CosemClass
(id = 99, obis = "0.2.0.0.0.255", version = 2) public class DemoClass { @CosemAttribute
(id = 2) privateDataObject
data; ... }
The set and get methods may only throw an IllegalAttributeAccessException
.
@CosemClass
(id = 99, obis = "0.2.0.0.0.255", version = 2) public class DemoClass { @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 IDs in a class are not allowed.
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[] |
slector
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[] slector
NOTE: in oder this works, get and set methods with SelectiveAccessDescription
s for the attribute must be
provided.
SelectiveAccessDescription