Codota Logo
MonetaryAmountFactoryQueryBuilder.setPrecision
Code IndexAdd Codota to your IDE (free)

How to use
setPrecision
method
in
javax.money.MonetaryAmountFactoryQueryBuilder

Best Java code snippets using javax.money.MonetaryAmountFactoryQueryBuilder.setPrecision (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.javamoney/javamoney-tck

  /**
   * Creates an amount with the given precision.
   * @param precision the target precision
   * @return a corresponding amount.
   */
  public static MonetaryAmount createAmountWithPrecision(int precision) {
    MonetaryAmountFactoryQuery tgtContext = MonetaryAmountFactoryQueryBuilder.of().setPrecision(precision).build();
    MonetaryAmountFactory<?> exceedingFactory;
    try {
      exceedingFactory = Monetary.getAmountFactory(tgtContext);
      AssertJUnit.assertNotNull(exceedingFactory);
      MonetaryAmountFactory<? extends MonetaryAmount> bigFactory =
          Monetary.getAmountFactory(exceedingFactory.getAmountType());
      return bigFactory.setCurrency("CHF").setNumber(createNumberWithPrecision(precision)).create();
    } catch (MonetaryException e) {
      return null;
    }
  }
}
origin: JavaMoney/javamoney-examples

/**
 * @param args
 */
public static void main(String[] args) {
  MonetaryAmount amount = Monetary.getDefaultAmountFactory().setCurrency("EUR").setNumber(234).create();
  ConsoleUtils.printDetails(amount);
  amount = Monetary.getAmountFactory(FastMoney.class).setCurrency("EUR").setNumber(234).create();
  ConsoleUtils.printDetails(amount);
  amount = Monetary.getAmountFactory(
        MonetaryAmountFactoryQueryBuilder.of().setMaxScale(50).setPrecision(30).build())
         .setCurrency("EUR").setNumber(234).create();
  ConsoleUtils.printDetails(amount);
  Money amt1 = Money.of(10.1234556123456789, "USD");
  FastMoney amt2 = FastMoney.of(123456789, "USD");
  Money total = amt1.add(amt2).multiply(0.5)
      .remainder(1);
  ConsoleUtils.printDetails(total);
}
javax.moneyMonetaryAmountFactoryQueryBuildersetPrecision

Javadoc

Sets the required precision, the value 0 models unlimited precision.

Popular methods of MonetaryAmountFactoryQueryBuilder

  • of
    Creates a new instance of javax.money.CurrencyQueryBuilder.
  • build
    Creates a new instance of MonetaryAmountFactoryQuery based on the values of this Builder. Note that
  • setMaxScale
    Sets the maximal scale to be supported.
  • <init>
    Creates a new instance of javax.money.CurrencyQueryBuilder.
  • importContext
  • set
  • setTargetType

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • getContentResolver (Context)
  • startActivity (Activity)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now