当前位置: 首页>>代码示例>>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;未经允许,请勿转载。