java.util.Currency.getCurrencyCode()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中java.util.Currency.getCurrencyCode()方法的一些代码示例,展示了Currency.getCurrencyCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Currency.getCurrencyCode()方法的具体详情如下:
包路径:java.util.Currency
类名称:Currency
方法名:getCurrencyCode

Currency.getCurrencyCode介绍

[英]Returns this currency's ISO 4217 currency code.
[中]返回此货币的ISO 4217货币代码。

代码示例

代码示例来源:origin: spring-projects/spring-data-examples

@Override
  public String convert(Currency source) {
    return source.getCurrencyCode();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public String toString(Currency value) {
  return value.getCurrencyCode();
}

代码示例来源:origin: requery/requery

@Override
public String convertToPersisted(Currency value) {
  return value == null ? null : value.getCurrencyCode();
}

代码示例来源:origin: shopizer-ecommerce/shopizer

public String getCode() {
  if (currency.getCurrencyCode() != code) {
    return currency.getCurrencyCode();
  }
  return code;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
  public String convert(Currency source) {
    return source == null ? null : source.getCurrencyCode();
  }
}

代码示例来源:origin: shopizer-ecommerce/shopizer

public void setCurrency(java.util.Currency currency) {
  this.currency = currency;
  this.code = currency.getCurrencyCode();
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

public String getCurrencyCode() {
  return value.getCurrencyCode();
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public String getAsText() {
  Currency value = (Currency) getValue();
  return (value != null ? value.getCurrencyCode() : "");
}

代码示例来源:origin: spotbugs/spotbugs

private String getCurrencyCode() {
    return Currency.getInstance(Locale.getDefault()).getCurrencyCode();
  }
}

代码示例来源:origin: org.springframework/spring-beans

@Override
public String getAsText() {
  Currency value = (Currency) getValue();
  return (value != null ? value.getCurrencyCode() : "");
}

代码示例来源:origin: hibernate/hibernate-orm

@SuppressWarnings({ "unchecked" })
public <X> X unwrap(Currency value, Class<X> type, WrapperOptions options) {
  if ( value == null ) {
    return null;
  }
  if ( String.class.isAssignableFrom( type ) ) {
    return (X) value.getCurrencyCode();
  }
  throw unknownUnwrap( type );
}

代码示例来源:origin: MorphiaOrg/morphia

@Override
public Object encode(final Object value, final MappedField optionalExtraInfo) {
  return isValidCurrency(value) ? ((Currency) value).getCurrencyCode() : null;
}

代码示例来源:origin: robovm/robovm

/**
 * Sets the currency used by this decimal format. The min and max fraction
 * digits remain the same.
 *
 * @param currency
 *            the currency this {@code DecimalFormat} should use.
 * @see DecimalFormatSymbols#setCurrency(Currency)
 */
@Override
public void setCurrency(Currency currency) {
  ndf.setCurrency(Currency.getInstance(currency.getCurrencyCode()));
  symbols.setCurrency(currency);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

protected static String getCurrencyCode(BroadleafCurrency blCurrency) {
  if (blCurrency != null) {
    return blCurrency.getCurrencyCode();
  } else {
    return defaultCurrency().getCurrencyCode();
  }
}

代码示例来源:origin: robovm/robovm

public void setCurrency(Currency currency) {
  setSymbol(this.address, UNUM_CURRENCY_SYMBOL, currency.getSymbol());
  setSymbol(this.address, UNUM_INTL_CURRENCY_SYMBOL, currency.getCurrencyCode());
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void nullSafeSet(
    PreparedStatement statement,
    Object value,
    int index,
    SharedSessionContractImplementor session) throws HibernateException, SQLException {
  if ( value == null ) {
    statement.setNull( index, Types.NUMERIC );
    statement.setNull( index + 1, Types.VARCHAR );
  }
  else {
    MonetaryAmount currency = (MonetaryAmount) value;
    statement.setBigDecimal( index, currency.getValue() );
    statement.setString( index + 1, currency.getCurrency().getCurrencyCode() );
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public MonetaryAmount parse(String text, Locale locale) throws ParseException {
  CurrencyStyleFormatter formatter = new CurrencyStyleFormatter();
  Currency currency = determineCurrency(text, locale);
  CurrencyUnit currencyUnit = Monetary.getCurrency(currency.getCurrencyCode());
  formatter.setCurrency(currency);
  formatter.setPattern(this.pattern);
  Number numberValue = formatter.parse(text, locale);
  return Monetary.getDefaultAmountFactory().setNumber(numberValue).setCurrency(currencyUnit).create();
}

代码示例来源:origin: google/guava

public void testGet_misc() {
 assertNotNull(ArbitraryInstances.get(CharMatcher.class));
 assertNotNull(ArbitraryInstances.get(Currency.class).getCurrencyCode());
 assertNotNull(ArbitraryInstances.get(Locale.class));
 assertNotNull(ArbitraryInstances.get(Joiner.class).join(ImmutableList.of("a")));
 assertNotNull(ArbitraryInstances.get(Splitter.class).split("a,b"));
 assertThat(ArbitraryInstances.get(com.google.common.base.Optional.class)).isAbsent();
 ArbitraryInstances.get(Stopwatch.class).start();
 assertNotNull(ArbitraryInstances.get(Ticker.class));
 assertFreshInstanceReturned(Random.class);
 assertEquals(
   ArbitraryInstances.get(Random.class).nextInt(),
   ArbitraryInstances.get(Random.class).nextInt());
}

代码示例来源:origin: org.springframework/spring-context

@Override
public MonetaryAmount parse(String text, Locale locale) throws ParseException {
  CurrencyStyleFormatter formatter = new CurrencyStyleFormatter();
  Currency currency = determineCurrency(text, locale);
  CurrencyUnit currencyUnit = Monetary.getCurrency(currency.getCurrencyCode());
  formatter.setCurrency(currency);
  formatter.setPattern(this.pattern);
  Number numberValue = formatter.parse(text, locale);
  return Monetary.getDefaultAmountFactory().setNumber(numberValue).setCurrency(currencyUnit).create();
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public ClassMetadata buildClassMetadata(Class<?>[] entities, PersistencePackage persistencePackage, Map<MergedPropertyType, Map<String, FieldMetadata>> mergedProperties) {
  ClassMetadata cmd = new ClassMetadata();
  cmd.setCeilingType(persistencePackage.getCeilingEntityFullyQualifiedClassname());
  cmd.setSecurityCeilingType(persistencePackage.getSecurityCeilingEntityFullyQualifiedClassname());
  cmd.setPolymorphicEntities(dynamicEntityDao.getClassTree(entities));
  cmd.setCurrencyCode(Money.defaultCurrency().getCurrencyCode());
  cmd.setProperties(processMergedProperties(entities, mergedProperties));
  cmd.setTabAndGroupMetadata(dynamicEntityDao.getTabAndGroupMetadata(entities, cmd));
  return cmd;
}

相关文章