Class NumberDescriptor
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.number.NumberDescriptor
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,Serializable
- See Also:
-
Field Summary
Fields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexpandToFit(NumberDescriptor other) Widens this descriptor to also fit the other number: keeps the larger digit counts and becomes negative if either is.fromBigDecimal(BigDecimal bigDecimal) Describes the given value: its sign, whole digits (precision minus scale) and fraction digits (scale).fromBigInteger(BigInteger bigInteger) Describes the given whole number: its sign and digit count.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element element) Returns the field type for the described number: INT, LONG or BIG_INTEGER for whole numbers and DOUBLE or BIG_DECIMAL for fractions, depending on the digit count.intintReturns the total number of digits (whole plus fraction digits).intgetScale()Returns the number of fraction digits.intinthashCode()booleanbooleanisSigned()Indicates if the number needs a sign; same asisNegative().parseNumber(String value) Parses the string into the Java number class ofgetFieldType(), e.g.setFractionDigits(int fractionDigits) setNegative(boolean negative) setWholeDigits(int wholeDigits) toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toString()Returns a basic JSON representation of this instance.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.core.Bean
addExceptionPropertiesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties, exception, exception, exception
-
Constructor Details
-
NumberDescriptor
public NumberDescriptor()
-
-
Method Details
-
isNegative
public boolean isNegative() -
setNegative
-
getWholeDigits
public int getWholeDigits() -
setWholeDigits
-
getFractionDigits
public int getFractionDigits() -
setFractionDigits
-
isSigned
public boolean isSigned()Indicates if the number needs a sign; same asisNegative(). -
getPrecision
public int getPrecision()Returns the total number of digits (whole plus fraction digits). -
getScale
public int getScale()Returns the number of fraction digits. -
getFieldType
Returns the field type for the described number: INT, LONG or BIG_INTEGER for whole numbers and DOUBLE or BIG_DECIMAL for fractions, depending on the digit count. -
parseNumber
Parses the string into the Java number class ofgetFieldType(), e.g. anIntegerfor INT. -
expandToFit
Widens this descriptor to also fit the other number: keeps the larger digit counts and becomes negative if either is. -
fromBigDecimal
Describes the given value: its sign, whole digits (precision minus scale) and fraction digits (scale). -
fromBigInteger
Describes the given whole number: its sign and digit count. -
hashCode
public int hashCode() -
equals
-
toString
Description copied from class:BeanReturns a basic JSON representation of this instance. -
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException. -
fromXmlElement
-