org.sisioh.baseunits.scala.money

Money

class Money extends Ordered[Money] with Serializable

金額を表すクラス。

ある一定の「量」と「通貨単位」から成るクラスである。

Linear Supertypes
Serializable, Serializable, Ordered[Money], Comparable[Money], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Money
  2. Serializable
  3. Serializable
  4. Ordered
  5. Comparable
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Money(amount: BigDecimal, currency: Currency)

    amount

    scala.math.BigDecimal

    currency

    通貨単位 java.util.Currency

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. def *(other: BigDecimal): Money

  5. def +(other: Money): Money

  6. def -(other: Money): Money

  7. def /(divisor: Double): Money

  8. def <(that: Money): Boolean

    Definition Classes
    Ordered
  9. def <=(that: Money): Boolean

    Definition Classes
    Ordered
  10. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  12. def >(that: Money): Boolean

    Definition Classes
    Ordered
  13. def >=(that: Money): Boolean

    Definition Classes
    Ordered
  14. lazy val abs: Money

    Returns a org.sisioh.baseunits.scala.money.Money whose amount is the absolute amount of this org.sisioh.baseunits.scala.money.Money, and whose scale is this.

    Returns a org.sisioh.baseunits.scala.money.Money whose amount is the absolute amount of this org.sisioh.baseunits.scala.money.Money, and whose scale is this.scale().

    returns

    絶対金額

  15. val amount: BigDecimal

    scala.math.BigDecimal

  16. def applying(ratio: Ratio, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額に対して、指定したratioの割合の金額を返す。

    この金額に対して、指定したratioの割合の金額を返す。

    ratio

    割合

    roundingMode

    丸めモード

    returns

    指定した割合の金額

  17. def applying(ratio: Ratio, scale: Int, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額に対して、指定したratioの割合の金額を返す。

    この金額に対して、指定したratioの割合の金額を返す。

    ratio

    割合

    scale

    スケール

    roundingMode

    丸めモード

    returns

    指定した割合の金額

  18. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  19. val breachEncapsulationOfAmount: BigDecimal

    このオブジェクトのamountフィールド(量)を返す。

    このオブジェクトのamountフィールド(量)を返す。

    CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。

    How best to handle access to the internals? It is needed for database mapping, UI presentation, and perhaps a few other uses. Yet giving public access invites people to do the real work of the Money object elsewhere. Here is an experimental approach, giving access with a warning label of sorts. Let us know how you like it.

    returns

  20. val breachEncapsulationOfCurrency: Currency

    このオブジェクトのcurrencyフィールド(通貨単位)を返す。

    このオブジェクトのcurrencyフィールド(通貨単位)を返す。

    CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。

    returns

    通貨単位

  21. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def compare(that: Money): Int

    金額同士の比較を行う。

    金額同士の比較を行う。

    相対的に量が小さい方を「小さい」と判断する。通貨単位が異なる場合は java.lang.ClassCastException を スローするが、どちらか片方の量が0である場合は例外をスローしない。

    例えば10 USD0 JPYは、後者の方が小さい。 また、0 USD0 JPYは同じである。

    that

    比較対象

    returns

    Comparable.compareTo(Object)に準じる

    Definition Classes
    Money → Ordered
  23. def compareTo(that: Money): Int

    Definition Classes
    Ordered → Comparable
  24. val currency: Currency

    通貨単位 java.util.Currency

  25. def dividedBy(divisor: Money): Ratio

    この金額の、divisorに対する割合を返す。

    この金額の、divisorに対する割合を返す。

    divisor

    除数

    returns

    割合

    Exceptions thrown
    ArithmeticException

    引数divisorの量が0だった場合

    ClassCastException

    引数の通貨単位がこのインスタンスの通貨単位と異なる場合

  26. def dividedBy(divisor: Double, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額を、divisor個に均等に分割した場合の金額を返す。

    この金額を、divisor個に均等に分割した場合の金額を返す。

    divisor

    除数

    roundingMode

    丸めモード

    returns

    金額

  27. def dividedBy(divisor: BigDecimal, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額を、divisor個に均等に分割した場合の金額を返す。

    この金額を、divisor個に均等に分割した場合の金額を返す。

    divisor

    除数

    roundingMode

    丸めモード

    returns

    金額

  28. def dividedBy(divisor: Double): Money

    この金額を、divisor個に均等に分割した場合の金額を返す。

    この金額を、divisor個に均等に分割した場合の金額を返す。

    丸めモードは RoundingMode#HALF_EVEN を適用する。

    divisor

    除数

    returns

    金額

  29. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  30. def equals(obj: Any): Boolean

    Definition Classes
    Money → AnyRef → Any
  31. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. final def getClass(): Class[_]

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

    Definition Classes
    Money → AnyRef → Any
  34. def isGreaterThan(other: Money): Boolean

    このインスタンがあらわす金額が、otherよりも大きいかどうか調べる。

    このインスタンがあらわす金額が、otherよりも大きいかどうか調べる。

    等価の場合はfalseとする。

    other

    基準金額

    returns

    大きい場合はtrue、そうでない場合はfalse

    Exceptions thrown
    ClassCastException

    引数の通貨単位がこのインスタンスの通貨単位と異なる場合

  35. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  36. def isLessThan(other: Money): Boolean

    このインスタンがあらわす金額が、otherよりも小さいかどうか調べる。

    このインスタンがあらわす金額が、otherよりも小さいかどうか調べる。

    等価の場合はfalseとする。

    other

    基準金額

    returns

    小さい場合はtrue、そうでない場合はfalse

    Exceptions thrown
    ClassCastException

    引数の通貨単位がこのインスタンスの通貨単位と異なる場合

  37. lazy val isNegative: Boolean

    このインスタンがあらわす金額が、負の金額かどうか調べる。

    このインスタンがあらわす金額が、負の金額かどうか調べる。

    ゼロの場合はfalseとする。

    returns

    負の金額である場合はtrue、そうでない場合はfalse

  38. lazy val isPositive: Boolean

    このインスタンがあらわす金額が、正の金額かどうか調べる。

    このインスタンがあらわす金額が、正の金額かどうか調べる。

    ゼロの場合はfalseとする。

    returns

    正の金額である場合はtrue、そうでない場合はfalse

  39. lazy val isZero: Boolean

    このインスタンがあらわす金額が、ゼロかどうか調べる。

    このインスタンがあらわす金額が、ゼロかどうか調べる。

    returns

    ゼロである場合はtrue、そうでない場合はfalse

  40. def minus(other: Money): Money

    この金額からotherを差し引いた金額を返す。

    この金額からotherを差し引いた金額を返す。

    other

    金額

    returns

    差し引き金額

    Exceptions thrown
    ClassCastException

    引数の通貨単位がこのインスタンスの通貨単位と異なる場合

  41. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  42. lazy val negated: Money

    Returns a Money whose amount is (-amount), and whose scale is this.

    Returns a Money whose amount is (-amount), and whose scale is this.scale().

    returns

    金額

  43. final def notify(): Unit

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

    Definition Classes
    AnyRef
  45. def per(duration: Duration): MoneyTimeRate

    指定した時間量に対する、この金額の割合を返す。

    指定した時間量に対する、この金額の割合を返す。

    duration

    時間量

    returns

    割合

  46. def plus(other: Money): Money

    この金額にotherを足した金額を返す。

    この金額にotherを足した金額を返す。

    other

    金額

    returns

    足した金額

    Exceptions thrown
    ClassCastException

    引数の通貨単位がこのインスタンスの通貨単位と異なる場合

  47. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  48. def times(amount: Int): Money

    この金額にamountを掛けた金額を返す。

    この金額にamountを掛けた金額を返す。

    丸めモードは RoundingMode#HALF_EVEN を適用する。

    amount

    係数

    returns

    掛けた金額

  49. def times(amount: Double, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額にamountを掛けた金額を返す。

    この金額にamountを掛けた金額を返す。

    amount

    係数

    roundingMode

    丸めモード

    returns

    掛けた金額

  50. def times(amount: Double): Money

    この金額にamountを掛けた金額を返す。

    この金額にamountを掛けた金額を返す。

    丸めモードは RoundingMode#HALF_EVEN を適用する。

    amount

    係数

    returns

    掛けた金額

  51. def times(factor: BigDecimal, roundingMode: scala.math.BigDecimal.RoundingMode.Value): Money

    この金額にfactorを掛けた金額を返す。

    この金額にfactorを掛けた金額を返す。

    TODO: BigDecimal.multiply() scale is sum of scales of two multiplied numbers. So what is scale of times?

    factor

    係数

    roundingMode

    丸めモード

    returns

    掛けた金額

  52. def times(factor: BigDecimal): Money

    この金額にfactorを掛けた金額を返す。

    この金額にfactorを掛けた金額を返す。

    丸めモードは RoundingMode#HALF_EVEN を適用する。

    TODO: Many apps require carrying extra precision in intermediate calculations. The use of Ratio is a beginning, but need a comprehensive solution. Currently, an invariant of Money is that the scale is the currencies standard scale, but this will probably have to be suspended or elaborated in intermediate calcs, or handled with defered calculations like Ratio.

    factor

    係数

    returns

    掛けた金額

  53. def toString(localeOption: Option[Locale]): String

    指定したロケールにおける、単位つきの金額表現の文字列を返す。

    指定したロケールにおける、単位つきの金額表現の文字列を返す。

    localeOption

    ロケールのOptionNoneの場合は Locale#getDefault() を利用する。

    returns

    金額の文字列表現

  54. def toString(): String

    Definition Classes
    Money → AnyRef → Any
  55. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Ordered[Money]

Inherited from Comparable[Money]

Inherited from AnyRef

Inherited from Any

Ungrouped