List of usage examples for org.springframework.util StringUtils isEmpty
public static boolean isEmpty(@Nullable Object str)
From source file:cn.guoyukun.spring.cache.BaseCacheAspect.java
public <T> T get(Object key) { log.debug("cacheName:{}, get key:{}", cacheName, key); if (StringUtils.isEmpty(key)) { return null; }/* w w w. j a va 2s .com*/ Cache.ValueWrapper value = cache.get(key); if (value == null) { return null; } return (T) value.get(); }
From source file:com.biz.report.service.impl.ItemDashBoardServiceImpl.java
public List<Report1DataSet> readDataForAreaChart(String items, String months, String year) { if (!StringUtils.isEmpty(items) && items.contains("[")) { items = items.substring(1, items.length() - 1); }/*w w w .j a v a 2s. co m*/ String[] typeAr; if (!StringUtils.isEmpty(items) && items.contains(",")) { typeAr = items.split("[,]"); } else { typeAr = new String[] { items }; } if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } String[] monthAr; if (!StringUtils.isEmpty(months) && months.contains(",")) { monthAr = months.split("[,]"); } else { monthAr = new String[] { months }; } int typeCount = typeAr.length; List list = itemDashBoardDao.read(items, months, year); List<Report1> reportList = new MappingEngine().getList(list); logger.info(reportList.size()); List<Report1DataSet> dataSets = new ArrayList<Report1DataSet>(); for (int i = 0; i < typeCount; i++) { List<DataPoint> dataPoints = constructDataPoints(reportList, typeAr[i].trim(), monthAr, i); dataSets.add(new Report1DataSet("stackedArea", dataPoints, typeAr[i])); } return dataSets; }
From source file:com.biz.report.service.impl.CustomerServiceImpl.java
public List<Report1DataSet> readDataForAreaChart(String customers, String months, String year) { if (!StringUtils.isEmpty(customers) && customers.contains("[")) { customers = customers.substring(1, customers.length() - 1); }// www .j a va2s.c o m String[] typeAr; if (!StringUtils.isEmpty(customers) && customers.contains(",")) { typeAr = customers.split("[,]"); } else { typeAr = new String[] { customers }; } if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } String[] monthAr; if (!StringUtils.isEmpty(months) && months.contains(",")) { monthAr = months.split("[,]"); } else { monthAr = new String[] { months }; } int typeCount = typeAr.length; List list = customerReportDao.read(customers, months, year); List<Report1> reportList = new MappingEngine().getList(list); logger.info(reportList.size()); List<Report1DataSet> dataSets = new ArrayList<Report1DataSet>(); for (int i = 0; i < typeCount; i++) { List<DataPoint> dataPoints = constructDataPoints(reportList, typeAr[i].trim(), monthAr, i); dataSets.add(new Report1DataSet("stackedArea", dataPoints, typeAr[i])); } return dataSets; }
From source file:com.example.todo.selenium.RestLog.java
public void saveForced(StringWriter writer, String subTitle) { if (StringUtils.isEmpty(subTitle)) { subTitle = ""; } else {/*from w w w .j ava 2 s. c o m*/ subTitle = "-" + subTitle; } int sequenceNo = sequence.incrementAndGet(); String evidenceFile = String.format("rest_communi_%03d%s.txt", sequenceNo, subTitle); File pageSourceFile = new File(evidenceSavingDirectory, evidenceFile); try { FileUtils.writeStringToFile(pageSourceFile, writer.toString()); } catch (IOException e) { logger.error(e.toString()); } }
From source file:org.sample.SessionTest.app.PageSource.java
public void saveForced(WebDriver webDriver, String subTitle) { if (StringUtils.isEmpty(subTitle)) { subTitle = ""; } else {//w w w .j av a2s . c o m subTitle = "-" + subTitle; } int sequenceNo = sequence.incrementAndGet(); String evidenceFile = String.format("page_source_%03d%s.txt", sequenceNo, subTitle); File pageSourceFile = new File(evidenceSavingDirectory, evidenceFile); try { FileUtils.writeStringToFile(pageSourceFile, webDriver.getPageSource()); } catch (IOException e) { logger.error(e.toString()); } }
From source file:com.ge.predix.uaa.token.lib.HttpServletRequestUtil.java
private static String findHeader(final HttpServletRequest req, final List<String> headerNames) { String subdomain;/* w ww.jav a2 s . c o m*/ for (String name : headerNames) { subdomain = req.getHeader(name); if (!StringUtils.isEmpty(subdomain)) { return subdomain; } } return null; }
From source file:df.open.support.configuration.SwaggerConfiguration.java
@Bean public Docket swaggerApi() { System.out.println("?Swagger-api"); //selector //from w w w. j a v a 2 s . c om Predicate<RequestHandler> selector = Predicates.or((withClassAnnotation(Api.class)), (withMethodAnnotation(Api.class))); //RequestHandlerSelectors.any() //RequestHandlerSelectors.basePackage("com.example.controller") //path RequestMapping Predicate<String> apiPath = StringUtils.isEmpty(path) ? PathSelectors.any() : PathSelectors.ant(path); return new Docket(DocumentationType.SWAGGER_2).groupName("Base").select() // api?document .apis(selector) // api .paths(apiPath) // .build().apiInfo(apiInfo()); }
From source file:com.ocs.dynamo.importer.impl.BaseTextImporter.java
/** * Reads a numeric value form a unit (i.e. a single string or a single cell) * /*from w w w.j a v a 2s . c o m*/ * @param unit * @return */ protected Double getNumericValue(String unit) { String value = unit; if (StringUtils.isEmpty(value)) { return null; } try { return Double.valueOf(value); } catch (NumberFormatException ex) { throw new OCSImportException(value + " cannot be converted to a number"); } }
From source file:com.anderl.hibernate.ext.IgnorableFilter.java
public void initIgnoredUrls() { if (ignoredUrls != null) return;//from w w w. j av a2 s. c om String ignoredUrlsString = getFilterConfig().getInitParameter("ignoredUrls"); if (StringUtils.isEmpty(ignoredUrlsString)) return; this.ignoredUrls = Arrays.asList(ignoredUrlsString.split(",")); this.ignoredUrls = Lists.newArrayList(Collections2.filter(ignoredUrls, new Predicate<String>() { @Override public boolean apply(String ignoredUrl) { return !StringUtils.isEmpty(ignoredUrl); } })); }
From source file:com.developmentsprint.spring.breaker.annotations.SpringCircuitBreakerAnnotationParser.java
public CircuitBreakerAttribute parseCircuitBreakerAnnotation(CircuitBreaker ann, AnnotatedElement ae) { DefaultCircuitBreakerAttribute attr = new DefaultCircuitBreakerAttribute(); if (StringUtils.isEmpty(ann.name()) && ae instanceof Method) { String name = ((Method) ae).getName(); attr.setName(name);//w ww . j a va 2s . c om } else { attr.setName(ann.name()); } if (ann.properties().length > 0) { Map<String, String> properties = new HashMap<String, String>(); for (CircuitProperty prop : ann.properties()) { properties.put(prop.key(), prop.value()); } attr.setProperties(properties); } return attr; }