congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MonetaryQuery.queryFrom
Code IndexAdd Tabnine to your IDE (free)

How to use
queryFrom
method
in
javax.money.MonetaryQuery

Best Java code snippets using javax.money.MonetaryQuery.queryFrom (Showing top 9 results out of 315)

origin: org.javamoney/javamoney-tck

@Override
public <R> R query(MonetaryQuery<R> query) {
  return query.queryFrom(this);
}
origin: javax.money/money-api

/**
 * Queries this monetary amount for a value.
 * <p>
 * This queries this amount using the specified query strategy object.
 * <p>
 * Implementations must ensure that no observable state is altered when this read-only method is
 * invoked.
 *
 * @param <R>   the type of the result
 * @param query the query to invoke, not null
 * @return the query result, null may be returned (defined by the query)
 */
default <R> R query(MonetaryQuery<R> query){
  return query.queryFrom(this);
}
origin: org.javamoney.moneta/moneta-core

@Override
public <R> R query(MonetaryQuery<R> query) {
  Objects.requireNonNull(query);
  try {
    return query.queryFrom(this);
  } catch (MonetaryException e) {
    throw e;
  } catch (Exception e) {
    throw new MonetaryException("Query failed: " + query, e);
  }
}
origin: org.javamoney.moneta/moneta-core

@Override
public <T> T query(MonetaryQuery<T> query) {
  Objects.requireNonNull(query);
  try {
    return query.queryFrom(this);
  } catch (MonetaryException | ArithmeticException e) {
    throw e;
  } catch (Exception e) {
    throw new MonetaryException("Query failed: " + query, e);
  }
}
origin: org.javamoney.moneta/moneta-core

@Override
public <R> R query(MonetaryQuery<R> query) {
  Objects.requireNonNull(query);
  try {
    return query.queryFrom(this);
  } catch (MonetaryException | ArithmeticException e) {
    throw e;
  } catch (Exception e) {
    throw new MonetaryException("Query failed: " + query, e);
  }
}
origin: org.jadira.usertype/usertype.core

@Override
protected Object[] toConvertedColumns(MonetaryAmount value) {
  return new Object[] { value.getCurrency(), MonetaryQueries.extractMajorPart().queryFrom(value).longValue() };
}
 
origin: org.jadira.usertype/usertype.core

@Override
protected Object[] toConvertedColumns(MonetaryAmount value) {
  return new Object[] { value.getCurrency(), MonetaryQueries.extractMajorPart().queryFrom(value).longValue() };
}
 
origin: org.jadira.usertype/usertype.core

@Override
public Long toNonNullValue(MonetaryAmount value) {
  if (!currencyUnit.equals(value.getCurrency())) {
    throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrency());
  }
  return MonetaryQueries.extractMajorPart().queryFrom(value).longValue();
}
origin: org.jadira.usertype/usertype.core

@Override
public Long toNonNullValue(MonetaryAmount value) {
  if (!currencyUnit.equals(value.getCurrency())) {
    throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrency());
  }
  return MonetaryQueries.extractMajorPart().queryFrom(value).longValue();
}
javax.moneyMonetaryQueryqueryFrom

Javadoc

Queries the specified monetary amount.

This queries the specified monetary amount to return an object using the logic encapsulated in the implementing class. Examples might be a query that checks if the amount is positive, or one that extracts the currency as a symbol.

There are two equivalent ways of using a MonetaryQuery. The first is to invoke the method on this interface. The second is to use MonetaryAmount#query(MonetaryQuery):

 
// these two lines are equivalent, but the second approach is recommended 
monetary = thisQuery.queryFrom(monetary); 
monetary = monetary.query(thisQuery); 
It is recommended to use the second approach, query(MonetaryQuery), as it is a lot clearer to read in code.

Implementation specification

The implementation must take the input object and query it. The implementation defines the logic of the query and is responsible for documenting that logic. It may use any method on MonetaryAmountto determine the result. The input object must not be altered.

This method may be called from multiple threads in parallel. It must be thread-safe when invoked.

Popular methods of MonetaryQuery

    Popular in Java

    • Start an intent from android
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • onRequestPermissionsResult (Fragment)
    • getSupportFragmentManager (FragmentActivity)
    • Font (java.awt)
      The Font class represents fonts, which are used to render text in a visible way. A font provides the
    • FileReader (java.io)
      A specialized Reader that reads from a file in the file system. All read requests made by calling me
    • Locale (java.util)
      Locale represents a language/country/variant combination. Locales are used to alter the presentatio
    • Queue (java.util)
      A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
    • Semaphore (java.util.concurrent)
      A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
    • JCheckBox (javax.swing)
    • Top plugins for WebStorm
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now