/** * Creates a new key based on the view definition and an ordered collection of market data * availability providers. * * @param viewDefinition the view definition, not null * @param marketDataProviders the market data availability providers, not null and not containing * nulls * @return the cache key, not null */ public static ViewExecutionCacheKey of( final ViewDefinition viewDefinition, final Iterable<MarketDataAvailabilityProvider> marketDataProviders) { final Collection<Serializable> tokens = new LinkedList<Serializable>(); for (MarketDataAvailabilityProvider marketDataProvider : marketDataProviders) { tokens.add(marketDataProvider.getAvailabilityHintKey()); } return new ViewExecutionCacheKey( viewDefinition.getUniqueId(), tokens.toArray(new Serializable[tokens.size()])); }
/** * Creates a new key based on the view definition and a single market data availability provider. * * @param viewDefinition the view definition, not null * @param marketDataProvider the market data availability provider, not null * @return the cache key, not null */ public static ViewExecutionCacheKey of( final ViewDefinition viewDefinition, final MarketDataAvailabilityProvider marketDataProvider) { return new ViewExecutionCacheKey( viewDefinition.getUniqueId(), new Serializable[] {marketDataProvider.getAvailabilityHintKey()}); }