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

How to use
MonetaryAmountFactoryQueryBuilder
in
javax.money

Best Java code snippets using javax.money.MonetaryAmountFactoryQueryBuilder (Showing top 11 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: javax.money/money-api

/**
 * Creates a new builder instances, initialized with the data from this one.
 *
 * @return a new {@link MonetaryAmountFactoryQueryBuilder} instance, never null.
 */
public MonetaryAmountFactoryQueryBuilder toBuilder() {
  return MonetaryAmountFactoryQueryBuilder.of(this);
}
origin: javax.money/money-api

/**
 * Creates a new instance of {@link javax.money.CurrencyQueryBuilder}.
 *
 * @return a new {@link javax.money.CurrencyQueryBuilder} instance, never null.
 */
public static MonetaryAmountFactoryQueryBuilder of(){
  return new MonetaryAmountFactoryQueryBuilder();
}
origin: javax.money/money-api

/**
 * Creates a new instance of {@link javax.money.CurrencyQueryBuilder}.
 *
 * @param monetaryAmountFactoryQuery {@link MonetaryAmountFactoryQuery} used for initializing this
 */
private MonetaryAmountFactoryQueryBuilder(MonetaryAmountFactoryQuery monetaryAmountFactoryQuery){
  Objects.requireNonNull(monetaryAmountFactoryQuery);
  importContext(monetaryAmountFactoryQuery);
}
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);
}
origin: org.javamoney/javamoney-tck

/**
 * Creates an amount with the given scale.
 * @param scale the target scale
 * @return the new amount.
 */
public static MonetaryAmount createAmountWithScale(int scale) {
  MonetaryAmountFactoryQuery tgtContext = MonetaryAmountFactoryQueryBuilder.of().setMaxScale(scale).build();
  MonetaryAmountFactory<?> exceedingFactory;
  try {
    exceedingFactory = Monetary.getAmountFactory(tgtContext);
    AssertJUnit.assertNotNull(exceedingFactory);
    MonetaryAmountFactory<? extends MonetaryAmount> bigFactory =
        Monetary.getAmountFactory(exceedingFactory.getAmountType());
    return bigFactory.setCurrency("CHF").setNumber(createNumberWithScale(scale)).create();
  } catch (MonetaryException e) {
    return null;
  }
}
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: org.javamoney/javamoney-tck

/**
 * Ensure correct query function implementations, providing also
 * the some test implementations with the TCK.
 */
@Test(description =
    "4.2.7 Ensure correct query function, Monetary.getAmountFactories should return factory" +
        "for explicit acquired amount types.")
@SpecAssertion(section = "4.2.7", id = "427-B4")
public void testAmountQueryType() {
  MonetaryAmountFactoryQuery ctx = MonetaryAmountFactoryQueryBuilder.of().setTargetType(TestAmount.class).build();
  Collection<MonetaryAmountFactory<?>> factories = Monetary.getAmountFactories(ctx);
  AssertJUnit.assertNotNull("Section 4.2.7: Amount factory query should return explicitly queried factories",
      factories);
  boolean found = false;
  for (MonetaryAmountFactory<?> f : factories) {
    if (f.getAmountType().equals(TestAmount.class)) {
      found = true;
      break;
    }
  }
  AssertJUnit.assertTrue("Section 4.2.7: Amount type query should return same explicitly queried factory", found);
  ctx = MonetaryAmountFactoryQueryBuilder.of().build();
  MonetaryAmountFactory<?> factory = Monetary.getAmountFactory(ctx);
  AssertJUnit.assertNotNull("Section 4.2.7: Amount type must be provided", factory);
}
origin: javax.money/money-api

/**
 * Sets the flag if the scale should fixed, meaning minimal scale and maximal scale are always equally sized.
 *
 * @param fixedScale the fixed scale flag.
 * @return this Builder for chaining.
 */
public MonetaryAmountFactoryQueryBuilder setFixedScale(boolean fixedScale){
  return set("fixedScale", fixedScale);
}
origin: javax.money/money-api

/**
 * Sets the maximal scale to be supported.
 *
 * @param maxScale the max scale, >= 0.
 * @return this Builder for chaining.
 */
public MonetaryAmountFactoryQueryBuilder setMaxScale(int maxScale){
  return set("maxScale", maxScale);
}
origin: javax.money/money-api

/**
 * Sets the required precision, the value 0 models unlimited precision.
 *
 * @param precision the precision, >= 0, 0 meaning unlimited.
 * @return this Builder for chaining.
 */
public MonetaryAmountFactoryQueryBuilder setPrecision(int precision){
  return set("precision", precision);
}
origin: javax.money/money-api

/**
 * Creates a new instance of {@link javax.money.CurrencyQueryBuilder}.
 *
 * @param monetaryAmountFactoryQuery {@link MonetaryAmountFactoryQuery} used for initializing this
 *                                   builder.
 * @return a new {@link MonetaryAmountFactoryQueryBuilder} instance, never null.
 */
public static MonetaryAmountFactoryQueryBuilder of(MonetaryAmountFactoryQuery monetaryAmountFactoryQuery){
  return new MonetaryAmountFactoryQueryBuilder(monetaryAmountFactoryQuery);
}
javax.moneyMonetaryAmountFactoryQueryBuilder

Javadoc

Builder class for creating new instances of MonetaryAmountFactoryQuery that can be passed to access MonetaryAmountFactory instances using a possible complex query.

Note this class is NOT thread-safe.

Most used methods

  • 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.
  • setPrecision
    Sets the required precision, the value 0 models unlimited precision.
  • <init>
    Creates a new instance of javax.money.CurrencyQueryBuilder.
  • importContext
  • set
  • setTargetType

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
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