net.liftweb.record.field

DecimalField

class DecimalField[OwnerType <: Record[OwnerType]] extends Field[BigDecimal, OwnerType] with MandatoryTypedField[BigDecimal] with DecimalTypedField

A field that maps to a decimal value. Decimal precision and rounding are controlled via the context parameter. The default value is zero.

Note:
Using MathContext.UNLIMITED, whether explicitly or implicitly, means that no precision or scaling will be used for the SQL field definition; the default scale for DECIMAL is zero per the SQL standard, but the precision for DECIMAL is vendor-specific. For example, PostgreSQL uses maximum precision if it's not specified, but SQL Server uses a default precision of 18.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DecimalField
  2. DecimalTypedField
  3. NumericTypedField
  4. MandatoryTypedField
  5. Product1
  6. Product
  7. Equals
  8. Field
  9. TypedField
  10. OwnedField
  11. BaseField
  12. BaseField
  13. FieldContainer
  14. SettableField
  15. SettableValueHolder
  16. Settable
  17. ReadableField
  18. Bindable
  19. ValueHolder
  20. FieldIdentifier
  21. AnyRef
  22. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DecimalField(rec: OwnerType, value: BigDecimal, context: MathContext)

    Constructs a DecimalField with the specified initial value and context.

    Constructs a DecimalField with the specified initial value and context. The scale is taken from the initial value.

    rec

    The Record that owns this field

    value

    The initial value

    context

    The MathContext that controls precision and rounding

  2. new DecimalField(rec: OwnerType, value: BigDecimal)

    Constructs a DecimalField with the specified initial value.

    Constructs a DecimalField with the specified initial value. The context is set to MathContext.UNLIMITED (see note above about default precision). The scale is taken from the initial value.

    rec

    The Record that owns this field

    value

    The initial value

  3. new DecimalField(rec: OwnerType, context: MathContext, scale: Int)

    rec

    The Record that owns this field

    context

    The MathContext that controls precision and rounding

    scale

    Controls the scale of the underlying BigDecimal

Type Members

  1. type MyType = BigDecimal

    Definition Classes
    TypedField
  2. type ValidationFunction = (ValueType) ⇒ List[FieldError]

    Definition Classes
    TypedField
  3. type ValueType = BigDecimal

    ValueType represents the type that users will work with.

    ValueType represents the type that users will work with. For MandatoryTypeField, this is equal to ThisType.

    Definition Classes
    MandatoryTypedFieldValueHolder

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def _1: MyType

    Definition Classes
    MandatoryTypedField → Product1
  7. def allFields: Seq[util.BaseField]

    Definition Classes
    BaseFieldFieldContainer
  8. def apply(in: Box[MyType]): OwnerType

    Definition Classes
    Field
  9. def apply(in: MyType): OwnerType

    Definition Classes
    Field
  10. def asHtml: NodeSeq

    Default read-only rendering of field

    Default read-only rendering of field

    Definition Classes
    ReadableFieldBindable
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def asJString(encode: (MyType) ⇒ String): JValue

    Helper for implementing asJValue for a conversion to an encoded JString

    Helper for implementing asJValue for a conversion to an encoded JString

    encode

    function to transform the field value into a String

    Attributes
    protected
    Definition Classes
    TypedField
  13. def asJValue: JValue

    Encode the field value into a JValue

    Encode the field value into a JValue

    Definition Classes
    DecimalTypedFieldBaseField
  14. def asJs: JsExp with Product with Serializable

    Returns the field's value as a valid JavaScript expression

    Returns the field's value as a valid JavaScript expression

    Definition Classes
    NumericTypedFieldBaseField
  15. def asString: String

    Convert the field to a String.

    Convert the field to a String... usually of the form "displayName=value"

    Definition Classes
    TypedFieldBaseField
  16. def atomicUpdate(f: (ValueType) ⇒ ValueType): ValueType

    Perform an atomic update of this Settable.

    Perform an atomic update of this Settable. The current value is passed to the function and the ValueHolder is set to the result of the function. This is enclosed in the performAtomicOperation method which will, by default, synchronize this instance

    Definition Classes
    Settable
  17. implicit def boxNodeFuncToFieldError(in: (Box[MyType]) ⇒ Box[Node]): (Box[MyType]) ⇒ List[FieldError]

    Attributes
    protected
    Definition Classes
    TypedField
  18. implicit def boxNodeToFieldError(in: Box[Node]): List[FieldError]

    Attributes
    protected
    Definition Classes
    TypedField
  19. def canEqual(a: Any): Boolean

    Definition Classes
    MandatoryTypedField → Equals
  20. def canRead_?: Boolean

    Can the value of this field be read without obscuring the result?

    Can the value of this field be read without obscuring the result?

    Definition Classes
    BaseField
  21. def canWrite_?: Boolean

    Can the value of this field be written?

    Can the value of this field be written?

    Definition Classes
    BaseField
  22. def checkCanRead_?: Boolean

    If the owner is not in "safe" mode, check the current environment to see if the field can be read

    If the owner is not in "safe" mode, check the current environment to see if the field can be read

    Definition Classes
    BaseField
  23. def checkCanWrite_?: Boolean

    If the owner is not in "safe" mode, check the current environment to see if the field can be written

    If the owner is not in "safe" mode, check the current environment to see if the field can be written

    Definition Classes
    BaseField
  24. def clear: Unit

    Clear the value of this field

    Clear the value of this field

    Definition Classes
    TypedField
  25. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. val context: MathContext

    The MathContext that controls precision and rounding

    The MathContext that controls precision and rounding

    Definition Classes
    DecimalFieldDecimalTypedField
  27. def defaultValue: BigDecimal

    Definition Classes
    DecimalTypedField
  28. def defaultValueBox: Box[MyType]

    The default value of the field when no value is set.

    The default value of the field when no value is set. Must return a Full Box unless optional_? is true

    Definition Classes
    MandatoryTypedFieldTypedField
  29. def dirty_?: Boolean

    Definition Classes
    BaseField
  30. def dirty_?(b: Boolean): Unit

    Attributes
    protected
    Definition Classes
    BaseField
  31. def displayHtml: NodeSeq

    Definition Classes
    ReadableField
  32. def displayName: String

    The display name of this field (e.

    The display name of this field (e.g., "First Name")

    Definition Classes
    OwnedFieldReadableField
  33. def displayNameHtml: Box[NodeSeq]

    Definition Classes
    ReadableField
  34. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  35. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  36. def fieldId: Option[NodeSeq]

    A unique 'id' for the field for form generation

    A unique 'id' for the field for form generation

    Definition Classes
    SettableField
  37. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  38. def forceDirty_?: Boolean

    Should the dirty flag always be set when setBox is called

    Should the dirty flag always be set when setBox is called

    Definition Classes
    BaseField
  39. def formElemAttrs: Seq[http.SHtml.ElemAttr]

    What form elements are we going to add to this field?

    What form elements are we going to add to this field?

    Definition Classes
    BaseField
  40. def formInputType: String

    Form field's type.

    Form field's type. Defaults to 'text', but you may want to change it to other HTML5 values.

    Definition Classes
    BaseField
  41. final def genericSetFromAny(in: Any)(implicit m: Manifest[MyType]): Box[MyType]

    Generic implementation of setFromAny that implements exactly what the doc for setFromAny specifies, using a Manifest to check types

    Generic implementation of setFromAny that implements exactly what the doc for setFromAny specifies, using a Manifest to check types

    Attributes
    protected
    Definition Classes
    TypedField
  42. def get: MyType

    get the value

    get the value

    Definition Classes
    MandatoryTypedFieldValueHolder
  43. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  44. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  45. def helpAsHtml: Box[NodeSeq]

    Definition Classes
    SettableField
  46. def ignoreField_?: Boolean

    Should the field be ignored by the OR Mapper?

    Should the field be ignored by the OR Mapper?

    Definition Classes
    BaseField
  47. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  48. def label: NodeSeq

    Definition Classes
    BaseField
  49. def liftSetFilterToBox(in: Box[MyType]): Box[MyType]

    OptionalTypedField and MandatoryTypedField implement this to do the appropriate lifting of Box[MyType] to ValueType

    OptionalTypedField and MandatoryTypedField implement this to do the appropriate lifting of Box[MyType] to ValueType

    Attributes
    protected
    Definition Classes
    MandatoryTypedFieldTypedField
  50. def name: String

    The text name of this field

    The text name of this field

    Definition Classes
    OwnedFieldReadableField
  51. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  52. def noValueErrorMessage: String

    The error message used when the field value could not be set

    The error message used when the field value could not be set

    Definition Classes
    NumericTypedFieldBaseField
  53. implicit def nodeToFieldError(node: Node): List[FieldError]

    Attributes
    protected
    Definition Classes
    TypedField
  54. def notOptionalErrorMessage: String

    The error message used when the field value must be set

    The error message used when the field value must be set

    Definition Classes
    BaseField
  55. final def notify(): Unit

    Definition Classes
    AnyRef
  56. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  57. def obscure(in: MyType): Box[MyType]

    Definition Classes
    TypedField
  58. def optional_?: Boolean

    Is the value of this field optional (e.

    Is the value of this field optional (e.g. NULLable)?

    Definition Classes
    MandatoryTypedFieldBaseField
  59. def owner: OwnerType

    Return the owner of this field

    Return the owner of this field

    Definition Classes
    DecimalFieldOwnedField
  60. def performAtomicOperation[T](f: ⇒ T): T

    Perform an atomic operation on the Settable.

    Perform an atomic operation on the Settable. By default synchronizes the instance, but it could use other mechanisms

    Definition Classes
    Settable
  61. def productArity: Int

    Definition Classes
    Product1 → Product
  62. def productElement(n: Int): Any

    Definition Classes
    Product1 → Product
    Annotations
    @throws( ... )
  63. def productIterator: Iterator[Any]

    Definition Classes
    Product
  64. def productPrefix: String

    Definition Classes
    Product
  65. def required_?: Boolean

    Is the Field required (and will have a style designating it as such)

    Is the Field required (and will have a style designating it as such)

    Definition Classes
    SettableField
  66. def resetDirty: Unit

    Definition Classes
    BaseField
  67. def runFilters(in: Box[MyType], filter: List[(Box[MyType]) ⇒ Box[MyType]]): Box[MyType]

    Definition Classes
    TypedField
  68. def runValidation(in: Box[MyType]): List[FieldError]

    Helper function that does validation of a value by using the validators specified for the field

    Helper function that does validation of a value by using the validators specified for the field

    Attributes
    protected
    Definition Classes
    TypedField
  69. final def safe_?: Boolean

    Are we in "safe" mode (i.

    Are we in "safe" mode (i.e., the value of the field can be read or written without any security checks.)

    Definition Classes
    OwnedFieldBaseField
  70. val scale: Int

    Controls the scale of the underlying BigDecimal

    Controls the scale of the underlying BigDecimal

    Definition Classes
    DecimalFieldDecimalTypedField
  71. def set(in: MyType): MyType

    Set the value of the field to the given value.

    Set the value of the field to the given value. Note: Because setting a field can fail (return non-Full), this method will return defaultValue if the field could not be set.

    Definition Classes
    MandatoryTypedFieldSettable
  72. def setBox(in: Box[MyType]): Box[MyType]

    Definition Classes
    TypedField
  73. def setFilter: List[(ValueType) ⇒ ValueType]

    A list of functions that transform the value before it is set.

    A list of functions that transform the value before it is set. The transformations are also applied before the value is used in a query. Typical applications of this are trimming and/or toLowerCase-ing strings

    Definition Classes
    TypedFieldSettableField
  74. def setFilterBox: List[(Box[MyType]) ⇒ Box[MyType]]

    A list of functions that transform the value before it is set.

    A list of functions that transform the value before it is set. The transformations are also applied before the value is used in a query. Typical applications of this are trimming and/or toLowerCase-ing strings

    Attributes
    protected
    Definition Classes
    TypedField
  75. def setFromAny(in: Any): Box[BigDecimal]

    Set the value of the field from anything.

    Set the value of the field from anything. Implementations of this method should accept at least the following (pattern => valueBox)

    • value: MyType => setBox(Full(value))
    • Some(value: MyType) => setBox(Full(value))
    • Full(value: MyType) => setBox(Full(value))
    • (value: MyType)::_ => setBox(Full(value))
    • s: String => setFromString(s)
    • Some(s: String) => setFromString(s)
    • Full(s: String) => setFromString(s)
    • null|None|Empty => setBox(defaultValueBox)
    • f: Failure => setBox(f) And usually convert the input to a string and uses setFromString as a last resort.

    Note that setFromAny should _always_ call setBox, even if the conversion fails. This is so that validation properly notes the error.

    The method genericSetFromAny implements this guideline.

    Definition Classes
    DecimalTypedFieldTypedField
  76. def setFromJString(jvalue: JValue)(decode: (String) ⇒ Box[MyType]): Box[MyType]

    Helper for implementing setFromJValue for a conversion from an encoded JString

    Helper for implementing setFromJValue for a conversion from an encoded JString

    decode

    function to try and transform a String into a field value

    Attributes
    protected
    Definition Classes
    TypedField
  77. def setFromJValue(jvalue: JValue): Box[MyType]

    Decode the JValue and set the field to the decoded value.

    Decode the JValue and set the field to the decoded value. Returns Empty or Failure if the value could not be set

    Definition Classes
    DecimalTypedFieldTypedField
  78. def setFromString(s: String): Box[BigDecimal]

    Set the value of the field using some kind of type-specific conversion from a String.

    Set the value of the field using some kind of type-specific conversion from a String. By convention, if the field is optional_?, then the empty string should be treated as no-value (Empty). Note that setFromString should _always_ call setBox, even if the conversion fails. This is so that validation properly notes the error.

    returns

    Full(convertedValue) if the conversion succeeds (the field value will be set by side-effect) Empty or Failure if the conversion does not succeed

    Definition Classes
    DecimalTypedFieldTypedField
  79. final def setNumericFromAny(in: Any, f: (Number) ⇒ MyType)(implicit m: Manifest[MyType]): Box[MyType]

    Augments genericSetFromAny with support for values of type Number (optionally wrapped in any of the usual suspects)

    Augments genericSetFromAny with support for values of type Number (optionally wrapped in any of the usual suspects)

    Attributes
    protected
    Definition Classes
    NumericTypedField
  80. def set_!(in: BigDecimal): BigDecimal

    Definition Classes
    DecimalTypedField
  81. def set_!(in: Box[MyType]): Box[MyType]

    Attributes
    protected
    Definition Classes
    TypedField
  82. def shouldDisplay_?: Boolean

    Given the current context, should this field be displayed

    Given the current context, should this field be displayed

    Definition Classes
    ReadableField
  83. def show_?: Boolean

    Given the current state of things, should this field be shown

    Given the current state of things, should this field be shown

    Definition Classes
    SettableField
  84. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  85. def tabIndex: Int

    Definition Classes
    BaseField
  86. def toBoxMyType(in: ValueType): Full[ValueType]

    Definition Classes
    MandatoryTypedFieldTypedField
  87. def toForm: Box[NodeSeq]

    Returns form input of this field

    Returns form input of this field

    Definition Classes
    NumericTypedFieldBaseFieldSettableField
  88. def toString(): String

    Definition Classes
    MandatoryTypedField → AnyRef → Any
  89. def toValueType(in: Box[MyType]): MyType

    Definition Classes
    MandatoryTypedFieldTypedField
  90. def toXHtml: NodeSeq

    Convert the field value to an XHTML representation

    Convert the field value to an XHTML representation

    Definition Classes
    BaseField
  91. def uniqueFieldId: Box[String]

    Definition Classes
    BaseFieldFieldIdentifier
  92. def uploadField_?: Boolean

    Is this an upload field so that a form that includes this field must be multi-part mime

    Is this an upload field so that a form that includes this field must be multi-part mime

    Definition Classes
    SettableField
  93. def validate: List[FieldError]

    Validate this field's setting, returning any errors found

    Validate this field's setting, returning any errors found

    Definition Classes
    TypedFieldSettableField
  94. def validations: List[(ValueType) ⇒ List[FieldError]]

    Definition Classes
    TypedFieldSettableField
  95. def value: MyType

    Definition Classes
    MandatoryTypedField
  96. def valueBox: Box[MyType]

    Definition Classes
    TypedField
  97. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  98. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  99. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def is: MyType

    Get the value.

    Get the value. Use get.

    Definition Classes
    MandatoryTypedFieldValueHolder
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6) Use get

Inherited from DecimalTypedField

Inherited from NumericTypedField[BigDecimal]

Inherited from Product1[BigDecimal]

Inherited from Product

Inherited from Equals

Inherited from Field[BigDecimal, OwnerType]

Inherited from TypedField[BigDecimal]

Inherited from OwnedField[OwnerType]

Inherited from BaseField

Inherited from util.BaseField

Inherited from FieldContainer

Inherited from SettableField

Inherited from SettableValueHolder

Inherited from Settable

Inherited from ReadableField

Inherited from Bindable

Inherited from ValueHolder

Inherited from FieldIdentifier

Inherited from AnyRef

Inherited from Any

Ungrouped