public class CounterEvent extends EventObject
CounterEvent
is an event object that indicates that a specific
counter needs to be incremented.
At the same time a CounterEvent
can be used by the event originator to retrieve the actual value of the
specified counter. Listeners that maintain the specified counter value,
must set the new value when receiving the CounterEvent
by using
the setCurrentValue(Variable currentValue)
method.
source
Constructor and Description |
---|
CounterEvent(Object source,
OID oid)
Creates a
CounterEvent for the specified counter. |
CounterEvent(Object source,
OID oid,
long increment)
Creates a
CounterEvent for the specified counter. |
CounterEvent(Object source,
OID oid,
Object index,
long increment)
Creates a
CounterEvent for the specified counter. |
Modifier and Type | Method and Description |
---|---|
Variable |
getCurrentValue()
Gets the current value of the counter, as set by the maintainer of the
counter (one of the event listeners).
|
long |
getIncrement()
The increment to be added to the counter value on behalf of this event.
|
Object |
getIndex()
The index identifier of the counter value (if the counter belongs to a table of counters).
|
OID |
getOid()
Gets the instance object identifier of the counter.
|
void |
setCurrentValue(Variable currentValue)
Sets the current value of the counter.
|
void |
setIncrement(long increment)
Sets the increment of the event.
|
String |
toString() |
getSource
public CounterEvent(Object source, OID oid)
CounterEvent
for the specified counter.source
- the source of the event.oid
- the OID of the counter instance (typically, the counter is a scalar and
thus the OID has to end on zero).public CounterEvent(Object source, OID oid, long increment)
CounterEvent
for the specified counter.source
- the source of the event.oid
- the OID of the counter instance (typically, the counter is a scalar and
thus the OID has to end on zero).increment
- a positive natural number (default is 1) that defines the increment
that needs to be added to the counter on behalf of this event.public CounterEvent(Object source, OID oid, Object index, long increment)
CounterEvent
for the specified counter.source
- the source of the event.oid
- the OID of the counter instance (typically, the counter is a scalar and
thus the OID has to end on zero).index
- an counter defined object that identifies the counter row within a table of counters.increment
- a positive natural number (default is 1) that defines the increment
that needs to be added to the counter on behalf of this event.public OID getOid()
OID
.public Variable getCurrentValue()
public void setCurrentValue(Variable currentValue)
public long getIncrement()
public void setIncrement(long increment)
increment
- the counter increment (must be a positive value for Counter32 counters!). For Counter64 counters,
the value might be negative but is then interpreted as an unsinged long value.public Object getIndex()
null
if the counter is a scalar value.public String toString()
toString
in class EventObject
Copyright © 2016 SNMP4J.org. All rights reserved.