List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:io.bitsquare.app.BitsquareExecutable.java
protected static String description(String descText, Object defaultValue) { String description = ""; if (StringUtils.hasText(descText)) description = description.concat(descText); if (defaultValue != null) description = join(" ", description, format("(default: %s)", defaultValue)); return description; }
From source file:org.cloudfoundry.identity.uaa.login.ChangePasswordValidation.java
public boolean valid() { return StringUtils.hasText(password) && StringUtils.hasText(passwordConfirmation) && password.equals(passwordConfirmation); }
From source file:org.openmrs.module.tribe.TribeEditor.java
public void setAsText(String text) throws IllegalArgumentException { TribeService ts = (TribeService) Context.getService(TribeService.class); if (StringUtils.hasText(text)) { try {/*from www .j a v a 2 s.c o m*/ setValue(ts.getTribe(Integer.valueOf(text))); } catch (Exception ex) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("Tribe not found: " + ex.getMessage(), ex); } } else { setValue(null); } }
From source file:io.dyn.net.tcp.stomp.StompMessages.java
private static void addHeaders(StompMessage msg, Object... headers) { String name = ""; for (int i = 0; i < headers.length; i++) { String s;//from w ww . jav a 2 s . co m if (headers[i] instanceof String) { s = (String) headers[i]; } else { s = Sys.DEFAULT_CONVERSION_SERVICE.convert(headers[i], String.class); } if (i % 2 == 0) { name = s; } else { if (StringUtils.hasText(name)) { msg.header(name, s); } } } }
From source file:com.consol.citrus.selenium.action.StartAction.java
@Override public void doExecute(TestContext context) { logger.info("Starting the WebClient."); webClient.start();/*from w w w . j a va2 s.c om*/ if (StringUtils.hasText(url)) { String convertedUrl = context.replaceDynamicContentInString(url); try { URL pageUrl = new URL(convertedUrl); } catch (MalformedURLException ex) { if (StringUtils.hasText(webClient.getStartUrl())) { String baseUrl = webClient.getStartUrl(); String lastChar = baseUrl.substring(baseUrl.length() - 1); if (!lastChar.equals("/")) { baseUrl = baseUrl + "/"; } this.url = baseUrl + convertedUrl; } else { throw new CitrusRuntimeException(ex); } } } super.doExecute(context); }
From source file:com.oembedler.moon.graphql.engine.GraphQLSchemaDiscoverer.java
public static Set<Class<?>> findSchemaClasses(final String basePackage) throws ClassNotFoundException { Set<Class<?>> initialEntitySet = new HashSet<Class<?>>(); if (StringUtils.hasText(basePackage)) { ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider( false);// w ww. j ava 2s . c o m componentProvider.addIncludeFilter(new AnnotationTypeFilter(GRAPH_QL_SCHEMA_ANNOTATION)); for (BeanDefinition candidate : componentProvider.findCandidateComponents(basePackage)) { initialEntitySet.add(ClassUtils.forName(candidate.getBeanClassName(), GraphQLSchemaDiscoverer.class.getClassLoader())); } } return initialEntitySet; }
From source file:jails.http.MediaTypeEditor.java
@Override public void setAsText(String text) { if (StringUtils.hasText(text)) { setValue(MediaType.parseMediaType(text)); } else {// www . ja v a 2 s. c om setValue(null); } }
From source file:nh.examples.springintegration.order.domain.commands.CreateOrderCommand.java
public CreateOrderCommand(String customerName, String customerEmail) { checkArgument(StringUtils.hasText(customerName), "A valid customer name must be specified"); _customerName = checkNotNull(customerName); _customerEmail = checkNotNull(customerEmail); }
From source file:org.eclipse.virgo.samples.formtags.par.web.validation.CountryValidator.java
public void setBadPlaceholderCode(String badPlaceholderCode) { this.badPlaceholderCode = StringUtils.hasText(badPlaceholderCode) ? badPlaceholderCode : DEFAULT_BAD_PLACEHOLDER_CODE; }
From source file:com.formkiq.core.util.Resources.java
/** * Gets a file from classpath as bytes.//from w w w . j a va 2 s. c om * @param file {@link String} * @return {@link String} * @throws IOException IOException */ public static InputStream getResourceAsInputStream(final String file) throws IOException { InputStream is = null; Resource resource = new ClassPathResource(file); try { is = resource.getInputStream(); } catch (FileNotFoundException e) { // check for file in tomcat conf directory String catalinabase = System.getProperty("catalina.base"); if (StringUtils.hasText(catalinabase)) { File configDir = new File(catalinabase, "conf"); File configFile = new File(configDir, file); if (configFile.exists()) { is = new FileInputStream(configFile); } } } return is; }