public class CounterModel extends java.lang.Object implements XMLMarshallable
The XML APIs specify the following XSD fragment:
XSD Fragment
<xs:element name="counter" type="CounterModelObjectType" />
<xs:complexType name="CounterModelObjectType">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:decimal"/>
<xs:attribute name="operation" type="CounterOperationType" use="optional" />
</xs:complexType>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG_NAME
The value of that constant is the XML tag name of the
CounterModel. |
| Constructor and Description |
|---|
CounterModel()
Constructs an empty counter object.
|
CounterModel(CounterDescriptionModel counterDesc)
Constructs a counter object from a Counter description object
|
CounterModel(java.lang.String name)
Constructs a counter object with a name.
|
CounterModel(java.lang.String name,
java.math.BigDecimal value)
Constructs a counter object with a name and a current value.
|
CounterModel(java.lang.String name,
java.math.BigDecimal value,
DistributedCounterOperationType operationType)
Constructs a counter object with a name, a current value and the smartMeter flag.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCharacterData(java.lang.String cData)
Adds character data to the content element.
|
void |
addChild(java.lang.String name,
XMLMarshallable child)
Adds a child to the object, the
child representing
the marshallable object which must be added to the element. |
boolean |
checkValidity()
Returns true if the counter is valid.
|
java.lang.String |
getName()
Returns the name of the counter.
|
DistributedCounterOperationType |
getOperationType()
Gets the type of distributed counter: increment or decrement.
|
java.math.BigDecimal |
getValue()
Returns the value of the counter.
|
boolean |
isIncrementCounter()
Returns true if the counter is shareable and is of type increment, false otherwise.
|
void |
marshal(XMLOutputter output)
Gives an XML representation of this object, including its children.
|
void |
marshal(XMLOutputter output,
java.lang.String tagName) |
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setName(java.lang.String name)
Sets the name of the counter.
|
void |
setOperationType(DistributedCounterOperationType distributedCounterOperationType)
Sets the operation type of the distributed counter.
|
void |
setValue(java.math.BigDecimal value)
Sets the value of the counter.
|
java.lang.String |
toString() |
public static final java.lang.String TAG_NAME
CounterModel.public CounterModel()
public CounterModel(java.lang.String name)
name - the name of the counter.public CounterModel(java.lang.String name,
java.math.BigDecimal value)
name - the name of the counter.value - the current value of the counter.public CounterModel(java.lang.String name,
java.math.BigDecimal value,
DistributedCounterOperationType operationType)
name - the name of the counter.value - the current value of the counter.operationType - type of distributed counters: increment or decrement, null for persistent counterspublic CounterModel(CounterDescriptionModel counterDesc)
counterDesc - the Counter description object used as base for the construction of the Counter object.public java.lang.String getName()
public void setName(java.lang.String name)
name - the name of the counter.public java.math.BigDecimal getValue()
public void setValue(java.math.BigDecimal value)
value - the value of the counter.public DistributedCounterOperationType getOperationType()
DistributedCounterOperationType the type of distributed counters: increment or decrement. Null for persistent counters.public void setOperationType(DistributedCounterOperationType distributedCounterOperationType)
distributedCounterOperationType - DistributedCounterOperationType the type of distributed counters: increment or decrement. Null for persistent counterspublic boolean isIncrementCounter()
public boolean checkValidity()
public void setAttributes(XMLAttributes atts)
XMLMarshallablesetAttributes in interface XMLMarshallableatts - The XML attributes of the current elementpublic void addChild(java.lang.String name,
XMLMarshallable child)
XMLMarshallablechild representing
the marshallable object which must be added to the element.addChild in interface XMLMarshallablename - The name of tag for the childchild - The child to be addedpublic void addCharacterData(java.lang.String cData)
XMLMarshallableaddCharacterData in interface XMLMarshallablecData - The character data to be addedpublic void marshal(XMLOutputter output)
XMLMarshallablemarshal in interface XMLMarshallableoutput - The XML output to marshal the object intopublic void marshal(XMLOutputter output, java.lang.String tagName)
public java.lang.String toString()
toString in class java.lang.Object