use of javax.money.convert.ProviderContextBuilder in project jsr354-ri-bp by JavaMoney.
the class CompoundRateProvider method createContext.
private static ProviderContext createContext(Iterable<ExchangeRateProvider> providers) {
Set<RateType> rateTypeSet = new HashSet<>();
StringBuilder providerName = new StringBuilder("Compound: ");
List<ProviderContext> childContextList = new ArrayList<>();
for (ExchangeRateProvider exchangeRateProvider : providers) {
childContextList.add(exchangeRateProvider.getContext());
providerName.append(exchangeRateProvider.getContext().getProviderName());
providerName.append(',');
rateTypeSet.addAll(exchangeRateProvider.getContext().getRateTypes());
}
providerName.setLength(providerName.length() - 1);
ProviderContextBuilder builder = ProviderContextBuilder.of(providerName.toString(), rateTypeSet);
builder.set(CHILD_PROVIDER_CONTEXTS_KEY, childContextList);
return builder.build();
}
use of javax.money.convert.ProviderContextBuilder in project jsr354-ri by JavaMoney.
the class CompoundRateProvider method createContext.
private static ProviderContext createContext(Iterable<ExchangeRateProvider> providers) {
Set<RateType> rateTypeSet = new HashSet<>();
StringBuilder providerName = new StringBuilder("Compound: ");
List<ProviderContext> childContextList = new ArrayList<>();
for (ExchangeRateProvider exchangeRateProvider : providers) {
childContextList.add(exchangeRateProvider.getContext());
providerName.append(exchangeRateProvider.getContext().getProviderName());
providerName.append(',');
rateTypeSet.addAll(exchangeRateProvider.getContext().getRateTypes());
}
providerName.setLength(providerName.length() - 1);
ProviderContextBuilder builder = ProviderContextBuilder.of(providerName.toString(), rateTypeSet);
builder.set(CHILD_PROVIDER_CONTEXTS_KEY, childContextList);
return builder.build();
}
Aggregations