public class BigDecimalDataElement extends DataElement<java.math.BigDecimal>
BigDecimal
values.Modifier and Type | Class and Description |
---|---|
static class |
BigDecimalDataElement.DisplayStyle
Enumeration of the available display styles.
|
DataElement.CopyMode, DataElement.Flag
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CURRENCY_CONSTRAINT
Input constraint for positive currency values.
|
static java.lang.String |
DECIMAL_GROUP_CHAR
The placeholder string for the decimal grouping character.
|
static java.lang.String |
DECIMAL_SEPARATOR_CHAR
The placeholder string for the decimal separator character.
|
static java.lang.String |
DEFAULT_CONSTRAINT
Default input constraint for positive or negative decimal values with
optional grouping characters.
|
static de.esoco.lib.property.PropertyName<BigDecimalDataElement.DisplayStyle> |
DISPLAY_STYLE
A style property that defines the rendering of big decimal values.
|
static java.lang.String |
SIGNED_CURRENCY_CONSTRAINT
A variant of
CURRENCY_CONSTRAINT that allows both positive and
negative valuess. |
ALLOWED_VALUES_CHANGED, ANONYMOUS_ELEMENT_PREFIX, DISPLAY_FLAGS, HIDDEN_URL, INPUT_FLAGS, INTERACTION_URL, ITEM_ALL_RESOURCE, ITEM_NEW_RESOURCE, ITEM_RESOURCE_PREFIX, PATH_SEPARATOR_CHAR, SERVER_PROPERTIES
Modifier | Constructor and Description |
---|---|
protected |
BigDecimalDataElement()
Default constructor for serialization.
|
|
BigDecimalDataElement(java.lang.String sName,
java.math.BigDecimal nValue)
Creates a new read-only instance with a certain name and value.
|
|
BigDecimalDataElement(java.lang.String sName,
java.math.BigDecimal rValue,
Validator<? super java.math.BigDecimal> rValidator,
java.util.Set<DataElement.Flag> rFlags)
Creates a new instance with a certain initial value and validator.
|
Modifier and Type | Method and Description |
---|---|
BigDecimalDataElement |
copy(DataElement.CopyMode eMode,
de.esoco.lib.property.PropertyName<?>... rCopyProperties)
Returns a copy of this data element that contains all or a subset of it's
current state.
|
java.math.BigDecimal |
getValue()
//~ Methods
----------------------------------------------------------------
/*************************************** Returns the value of this
element.
|
protected BigDecimalDataElement |
newInstance()
Returns a new instance of the respective data element sub-type on which
it is invoked.
|
void |
setStringValue(java.lang.String sValue)
Sets a string value.
|
protected void |
updateValue(java.math.BigDecimal rNewValue)
Updates the element value.
|
protected boolean |
valuesEqual(java.math.BigDecimal a,
java.math.BigDecimal b)
Checks two values for equality.
|
checkImmutable, checkValidValue, copyAttributes, copyValue, createItemName, createItemResource, createResourceId, equals, getAllowedValues, getElementValidator, getName, getParent, getPath, getResourceId, getRoot, getSimpleName, getValidator, getValueHashCode, hasEqualValueAs, hashCode, init, isImmutable, isModified, isOptional, isSelected, isValidValue, markAsChanged, readFrom, removeProperty, setModified, setProperty, setSelected, setValidator, setValue, toDebugString, toString, writeTo
clearFlag, clearProperties, setFlag, setProperties, setProperty, setProperty
convertCollection, convertMap, convertValue, ensurePropertyMapExists, findValue, getIntProperty, getProperty, getPropertyCount, getPropertyMap, getPropertyNames, hasEqualProperties, hasFlag, hasProperty, parseCollection, parseMap, parseValue, setPropertyMap
public static final de.esoco.lib.property.PropertyName<BigDecimalDataElement.DisplayStyle> DISPLAY_STYLE
public static final java.lang.String DECIMAL_GROUP_CHAR
public static final java.lang.String DECIMAL_SEPARATOR_CHAR
public static final java.lang.String DEFAULT_CONSTRAINT
DECIMAL_GROUP_CHAR
and DECIMAL_SEPARATOR_CHAR
which
must be replaced with the actual locale-specific pattern before using the
string as a regular expression.public static final java.lang.String CURRENCY_CONSTRAINT
SIGNED_CURRENCY_CONSTRAINT
. See the remarks for
DEFAULT_CONSTRAINT
.public static final java.lang.String SIGNED_CURRENCY_CONSTRAINT
CURRENCY_CONSTRAINT
that allows both positive and
negative valuess.public BigDecimalDataElement(java.lang.String sName, java.math.BigDecimal nValue)
sName
- The name of this elementnValue
- The initial valuepublic BigDecimalDataElement(java.lang.String sName, java.math.BigDecimal rValue, Validator<? super java.math.BigDecimal> rValidator, java.util.Set<DataElement.Flag> rFlags)
sName
- The name of this elementrValue
- The initial valuerValidator
- The validator for the value or NULL for nonerFlags
- The optional flags for this data elementprotected BigDecimalDataElement()
public BigDecimalDataElement copy(DataElement.CopyMode eMode, de.esoco.lib.property.PropertyName<?>... rCopyProperties)
flags
. Never
copied is the parent reference because upon copying typically a reference
to a copied parent needs to be set. The further data the copy contains
depends on the copy mode:
DataElement.CopyMode.FULL
: The copy contains all data (except the
parent reference).DataElement.CopyMode.FLAT
: like DataElement.CopyMode.FULL
but without
sub-ordinate data elements.DataElement.CopyMode.PROPERTIES
: The copy contains only the properties
but not the element value and attributes.DataElement.CopyMode.PLACEHOLDER
: The copy contains only the element
name to serve as a placeholder.The copy instance is created by invoking DataElement.newInstance()
which
has the recommendation to overwrite the return type to the concrete
subtype to prevent the need for casting by the invoking code. For the
same reason it is recommended that subclasses also override this method
with the concrete return type and cast the result of
super.copy()
to that type.
copy
in class DataElement<java.math.BigDecimal>
eMode
- The copy moderCopyProperties
- An optional list of properties to copy. If not
provided all properties will be copied (unless
the mode is DataElement.CopyMode.PLACEHOLDER
)public final java.math.BigDecimal getValue()
getValue
in class DataElement<java.math.BigDecimal>
public void setStringValue(java.lang.String sValue)
setStringValue
in class DataElement<java.math.BigDecimal>
sValue
- The new string valueprotected BigDecimalDataElement newInstance()
DataElement.copy(CopyMode, PropertyName...)
for cloning an instance.
Implementations should overwrite the return type with their concrete type
to prevent the need for casting by the invoking code.newInstance
in class DataElement<java.math.BigDecimal>
protected void updateValue(java.math.BigDecimal rNewValue)
DataElement.setValue(Object)
to store a new value after validation. If a subclass wants to reject
certain values it should do so in the DataElement.isValidValue(Validator,
Object)
method. Subclasses that are always immutable should implement an
assertion because if the element has been initialized correctly
(validator = NULL) this method should then be reached.updateValue
in class DataElement<java.math.BigDecimal>
rNewValue
- The new value for this elementprotected boolean valuesEqual(java.math.BigDecimal a, java.math.BigDecimal b)
Object.equals(Object)
but subclasses can override this for
more specific comparisons (e.g. by using Comparable
).valuesEqual
in class DataElement<java.math.BigDecimal>
a
- The first value to compare (can be be NULL)b
- The second value to compare (can be be NULL)