public class Money extends Element
Modifier and Type | Field and Description |
---|---|
static AttributeKey<java.lang.Double> |
AMOUNT
Amount.
|
static AttributeKey<java.lang.String> |
CURRENCY_CODE
ISO4217 currency code.
|
static ElementKey<java.lang.Void,Money> |
KEY
The key for this element.
|
Modifier | Constructor and Description |
---|---|
|
Money()
Constructs an instance using the default key.
|
protected |
Money(ElementKey<?,? extends Money> key)
Subclass constructor, allows subclasses to supply their own element key.
|
protected |
Money(ElementKey<?,? extends Money> key,
Element source)
Constructs a new instance by doing a shallow copy of data from an existing
Element instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.Double |
getAmount()
Returns the amount.
|
java.lang.String |
getCurrencyCode()
Returns the ISO4217 currency code.
|
boolean |
hasAmount()
Returns whether it has the amount.
|
boolean |
hasCurrencyCode()
Returns whether it has the ISO4217 currency code.
|
int |
hashCode() |
Money |
lock()
Locks this element.
|
static void |
registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.
|
Money |
setAmount(java.lang.Double amount)
Sets the amount.
|
Money |
setCurrencyCode(java.lang.String currencyCode)
Sets the ISO4217 currency code.
|
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hasTextValue, isLocked, narrow, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, toString, validate, visit
public static final ElementKey<java.lang.Void,Money> KEY
public static final AttributeKey<java.lang.Double> AMOUNT
public static final AttributeKey<java.lang.String> CURRENCY_CODE
public Money()
protected Money(ElementKey<?,? extends Money> key)
protected Money(ElementKey<?,? extends Money> key, Element source)
Element
instance. Will use the given ElementKey
as the key
for the element. This constructor is used when adapting from one element
key to another. You cannot call this constructor directly, instead use
Element.createElement(ElementKey, Element)
.key
- The key to use for this element.source
- source elementpublic static void registerMetadata(MetadataRegistry registry)
public Money lock()
Element
public java.lang.Double getAmount()
public Money setAmount(java.lang.Double amount)
amount
- amount or null
to resetpublic boolean hasAmount()
public java.lang.String getCurrencyCode()
public Money setCurrencyCode(java.lang.String currencyCode)
currencyCode
- ISO4217 currency code or null
to resetpublic boolean hasCurrencyCode()