本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例5: getCompaniesFallback
import io.pivotal.web.domain.CompanyInfo; //导入依赖的package包/类
private List<CompanyInfo> getCompaniesFallback(String name) {
List<CompanyInfo> infos = new ArrayList<>();
return infos;
}
示例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);
}
示例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);
}
示例8: getCompaniesFallback
import io.pivotal.web.domain.CompanyInfo; //导入依赖的package包/类
@SuppressWarnings("unused")
private List<CompanyInfo> getCompaniesFallback(String name) {
return new ArrayList<>();
}