List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:org.eclipse.gemini.blueprint.test.internal.util.jar.ManifestUtils.java
/** * Determine the Import-Package value based on the Export-Package entries in * the jars given as Resources.//from w w w . j av a 2 s .c om * @param resources * @return */ public static String[] determineImportPackages(Resource[] resources) { Set collection = new LinkedHashSet(); // for each resource for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; Manifest man = JarUtils.getManifest(resource); if (man != null) { // read the manifest // get the Export-Package Attributes attrs = man.getMainAttributes(); String exportedPackages = attrs.getValue(Constants.EXPORT_PACKAGE); // add it to the StringBuilder if (StringUtils.hasText(exportedPackages)) { collection.addAll(StringUtils.commaDelimitedListToSet(exportedPackages)); } } } // return the result as string String[] array = (String[]) collection.toArray(new String[collection.size()]); // clean whitespace just in case for (int i = 0; i < array.length; i++) { array[i] = StringUtils.trimWhitespace(array[i]); } return array; }
From source file:ch.ralscha.extdirectspring.bean.api.PollingProvider.java
public PollingProvider(String beanName, String method, String event) { this.beanName = beanName; this.method = method; if (StringUtils.hasText(event)) { this.event = event.trim(); } else {// w w w . ja v a2 s . co m this.event = method; } }
From source file:org.openmrs.module.pmtct.BooleanEditor.java
public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { try {/*from w w w. j a va 2s. co m*/ if (text.equals("1")) setValue(new Boolean(true)); else if (text.equals("0")) setValue(new Boolean(false)); } catch (Exception ex) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("User not found: " + ex.getMessage()); } } else { setValue(null); } }
From source file:org.openmrs.ModuleStory.java
/** * Utility method that checks if there is a runtime properties file containing database * connection credentials/*from w w w . ja v a 2 s. c o m*/ * * @return */ private static boolean skipDatabaseSetupPage() { Properties props = OpenmrsUtil.getRuntimeProperties(WebConstants.WEBAPP_NAME); return (props != null && StringUtils.hasText(props.getProperty("connection.url")) && StringUtils.hasText(props.getProperty("connection.username")) && StringUtils.hasText(props.getProperty("connection.password"))); }
From source file:org.openmrs.module.orderentryui.propertyeditor.DosingTypeEditor.java
/** * @should set using id//from ww w . j a v a2s. c o m * @should set using uuid * * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String) */ public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { setValue(DosingType.valueOf(text)); } else { setValue(null); } }
From source file:org.openmrs.module.orderentryui.propertyeditor.LateralityEditor.java
/** * @should set using id// ww w . jav a 2 s .c om * @should set using uuid * * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String) */ public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { setValue(Laterality.valueOf(text)); } else { setValue(null); } }
From source file:edu.wisc.my.stats.web.support.TimeResolutionEditor.java
/** * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String) *//*w w w. j a v a 2s . c o m*/ @Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasText(text)) { //TODO replace with commons-lang this.setValue(null); } else { final TimeResolution resolution = TimeResolution.valueOf(text); this.setValue(resolution); } }
From source file:fr.univlorraine.mondossierweb.utils.PropertyUtils.java
/** Retourne le nom du cluster elasticSearch */ public static String getElasticSearchCluster() { String value = System.getProperty("context.param.elasticsearch.cluster"); if (!StringUtils.hasText(value)) throw new NullPointerException("param.elasticsearch.cluster cannot be null !"); return value; }
From source file:org.moserp.common.converter.StringToPriceConverter.java
@Override public Price convert(String source) { return StringUtils.hasText(source) ? new Price(source) : null; }
From source file:org.moserp.common.converter.StringToQuantityConverter.java
@Override public Quantity convert(String source) { return StringUtils.hasText(source) ? new Quantity(source) : null; }