當前位置: 首頁>>代碼示例>>Java>>正文


Java CompanyInfo類代碼示例

本文整理匯總了Java中io.pivotal.web.domain.CompanyInfo的典型用法代碼示例。如果您正苦於以下問題:Java CompanyInfo類的具體用法?Java CompanyInfo怎麽用?Java CompanyInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CompanyInfo類屬於io.pivotal.web.domain包,在下文中一共展示了CompanyInfo類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getQuotes

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
private List<Quote> getQuotes(String companyName) {
	logger.debug("Fetching quotes for companies that have: " + companyName + " in name or symbol");
	List<CompanyInfo> companies = marketService.getCompanies(companyName);
	
	/*
	 * Sleuth currently doesn't work with parallelStreams
	 */
	//get distinct companyinfos and get their respective quotes in parallel.

	List<String> symbols = companies.stream().map(company -> company.getSymbol()).collect(Collectors.toList());
	logger.debug("symbols: fetching "+ symbols.size() + " quotes for following symbols: " + symbols);
	List<String> distinctsymbols = symbols.stream().distinct().collect(Collectors.toList());
	logger.debug("distinct: fetching "+ distinctsymbols.size() + " quotes for following symbols: " + distinctsymbols);
	List<Quote> quotes;
	if (distinctsymbols.size() > 0) {
		quotes = marketService.getMultipleQuotes(distinctsymbols).stream().distinct().filter(quote -> quote.getName() != null && !"".equals(quote.getName())).collect(Collectors.toList());
	} else {
		quotes = new ArrayList<>();
	}
	return quotes;
}
 
開發者ID:pivotal-bank,項目名稱:web-ui,代碼行數:22,代碼來源:TradeController.java

示例2: getQuotes

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
private List<Quote> getQuotes(String companyName) {
	logger.debug("Fetching quotes for companies that have: " + companyName + " in name or symbol");
	List<CompanyInfo> companies = marketService.getCompanies(companyName);
	
	/*
	 * Sleuth currently doesn't work with parallelStreams
	 */
	//get district companyinfos and get their respective quotes in parallel.
	//List<Quote> result = companies.stream().collect(Collectors.toCollection(
	//	      () -> new TreeSet<CompanyInfo>((p1, p2) -> p1.getSymbol().compareTo(p2.getSymbol())) 
	//		)).parallelStream().map(n -> getQuote(n.getSymbol())).collect(Collectors.toList());
	List<Quote> result = companies.stream().
			collect(Collectors.toCollection(() -> new TreeSet<>((p1, p2) -> p1.getSymbol().compareTo(p2.getSymbol())))).stream().
			map(n -> getQuote(n.getSymbol()).get(0)).
               collect(Collectors.toList());
	
	List<Quote> quotes = result.parallelStream().filter(n -> n.getStatus().startsWith("SUCCESS")).collect(Collectors.toList());
	return quotes;
}
 
開發者ID:dpinto-pivotal,項目名稱:cf-SpringBootTrader,代碼行數:20,代碼來源:TradeController.java

示例3: getQuotes

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
private List<Quote> getQuotes(String companyName) {
	logger.debug("Fetching quotes for companies that have: " + companyName + " in name or symbol");
	List<CompanyInfo> companies = marketService.getCompanies(companyName);
	
	//get district companyinfos and get their respective quotes in parallel.
	List<Quote> result = companies.stream().collect(Collectors.toCollection(
		      () -> new TreeSet<CompanyInfo>((p1, p2) -> p1.getSymbol().compareTo(p2.getSymbol())) 
			)).parallelStream().map(n -> getQuote(n.getSymbol())).collect(Collectors.toList());
	
	List<Quote> quotes = result.parallelStream().filter(n -> n.getStatus().startsWith("SUCCESS")).collect(Collectors.toList());
	return quotes;
}
 
開發者ID:trujillano,項目名稱:springBootTrader-aos,代碼行數:13,代碼來源:TradeController.java

示例4: getCompanies

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
@HystrixCommand(fallbackMethod = "getCompaniesFallback")
public List<CompanyInfo> getCompanies(String name) {
	logger.debug("Fetching companies with name or symbol matching: " + name);
	CompanyInfo[] infos = restTemplate.getForObject("http://" + quotesService + "/v1/company/{name}", CompanyInfo[].class, name);
	return Arrays.asList(infos);
}
 
開發者ID:pivotal-bank,項目名稱:web-ui,代碼行數:7,代碼來源:QuotesService.java

示例5: getCompaniesFallback

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
private List<CompanyInfo> getCompaniesFallback(String name) {
	List<CompanyInfo> infos = new ArrayList<>();
	return infos;
}
 
開發者ID:pivotal-bank,項目名稱:web-ui,代碼行數:5,代碼來源:QuotesService.java

示例6: getCompanies

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
@HystrixCommand(fallbackMethod = "getCompaniesFallback")
public List<CompanyInfo> getCompanies(String name) {
	logger.debug("Fetching companies with name or symbol matching: " + name);
	CompanyInfo[] infos = restTemplate.getForObject("http://quotes/company/{name}", CompanyInfo[].class, name);
	return Arrays.asList(infos);
}
 
開發者ID:trujillano,項目名稱:springBootTrader-aos,代碼行數:7,代碼來源:MarketService.java

示例7: getCompanies

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
@HystrixCommand(fallbackMethod = "getCompaniesFallback")
public List<CompanyInfo> getCompanies(String name) {
	logger.debug("Fetching companies with name or symbol matching: " + name);
	CompanyInfo[] infos = restTemplate.getForObject("http://" + quotesService + "/company/{name}", CompanyInfo[].class, name);
	return Arrays.asList(infos);
}
 
開發者ID:dpinto-pivotal,項目名稱:cf-SpringBootTrader,代碼行數:7,代碼來源:MarketService.java

示例8: getCompaniesFallback

import io.pivotal.web.domain.CompanyInfo; //導入依賴的package包/類
@SuppressWarnings("unused")
private List<CompanyInfo> getCompaniesFallback(String name) {
       return new ArrayList<>();
}
 
開發者ID:dpinto-pivotal,項目名稱:cf-SpringBootTrader,代碼行數:5,代碼來源:MarketService.java


注:本文中的io.pivotal.web.domain.CompanyInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。