List of usage examples for org.apache.commons.lang StringUtils isBlank
public static boolean isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
From source file:io.github.jeddict.jpa.spec.validator.column.ColumnValidator.java
public static boolean isEmpty(Column column) { return StringUtils.isBlank(column.getName()) && StringUtils.isBlank(column.getColumnDefinition()) && StringUtils.isBlank(column.getTable()) && column.getNullable() && column.getInsertable() && column.getUpdatable() && !column.getUnique() && (column.getLength() == null || column.getLength() == 255) && (column.getScale() == null || column.getScale() == 0) && (column.getPrecision() == null || column.getPrecision() == 0); }
From source file:com.yoncabt.ebr.executor.jasper.Convert.java
private static <T> T str2Number(String val, Class<T> valueClass) { if (StringUtils.isBlank(val)) { return null; }/*from ww w.ja va 2s . com*/ if (valueClass == Integer.class) { return (T) Integer.valueOf(val); } if (valueClass == Long.class) { return (T) Long.valueOf(val); } if (valueClass == Short.class) { return (T) Short.valueOf(val); } if (valueClass == Double.class) { return (T) Double.valueOf(val); } if (valueClass == BigDecimal.class) { return (T) new BigDecimal(val); } throw new IllegalArgumentException(val.getClass() + "->" + valueClass.getName()); }
From source file:io.github.lucaseasedup.logit.util.Validators.java
public static boolean validateIp(String ip) { if (StringUtils.isBlank(ip)) return false; return InetAddressUtils.isIPv4Address(ip) || InetAddressUtils.isIPv6Address(ip); }
From source file:com.uaihebert.test.helper.EntityManagerFactoryHelper.java
public static EntityManagerFactory createEntityManagerFactory(final String persistenUnit) { if (StringUtils.isBlank(persistenUnit)) { return Persistence.createEntityManagerFactory(PU_ECLIPSELINK); }//from w w w . j a va 2 s. c o m return Persistence.createEntityManagerFactory(persistenUnit); }
From source file:edu.duke.cabig.c3pr.utils.web.C3PRWebUtils.java
/** * Substring method for the UI./* w w w .j a v a2 s.co m*/ * * @param stringToBeManipulated the string to be manipulated * @param startIndex the start index * @param endIndex the end index * @return the string */ public static String substring(String stringToBeManipulated, int beginIndex, int endIndex) { if (!StringUtils.isBlank(stringToBeManipulated)) { return stringToBeManipulated.substring(beginIndex, endIndex); } return stringToBeManipulated; }
From source file:adalid.commons.properties.BootstrappingFile.java
public static void setName(String name) { if (bootstrapping_file_name == null) { if (StringUtils.isBlank(name)) { bootstrapping_file_name = BOOTSTRAPPING_FILE_NAME; logger.warn("null value for name parameter; defaults to " + bootstrapping_file_name); } else {/* w ww . j av a 2s. c om*/ bootstrapping_file_name = name; logger.info("using user-defined file name " + bootstrapping_file_name); } } else if (bootstrapping_file_name.equals(name)) { logger.debug("file name already set to " + bootstrapping_file_name); } else { logger.error("file name previously set to " + bootstrapping_file_name + " so now it cannot be set to " + name + " (once set, it cannot be changed)"); } }
From source file:com.cognifide.cq.cqsm.core.utils.MessagingUtils.java
public static String createMessage(Exception e) { return StringUtils.isBlank(e.getMessage()) ? "Internal error: " + e.getClass() : e.getMessage(); }
From source file:gov.nih.nci.calims2.ui.administration.customerservice.serviceitem.ServiceItemHelper.java
/** * Give the sub total value from quantity and rate. * //ww w .j a va 2 s. c om * @param row The ServiceItem type * @return The sub total corresponding to the given value. Returns null if the subtotal can not be calculated */ public static BigDecimal getsubTotalValue(ServiceItem row) { Quantity quantity = row.getQuantity(); Rate rate = row.getServiceItemRate(); if (quantity == null || StringUtils.isBlank(quantity.getValue()) || rate == null || rate.getQuantity() == null || StringUtils.isBlank(rate.getQuantity().getValue())) { return null; } BigDecimal bigDecQty = new BigDecimal(quantity.getValue()); BigDecimal bigDecRate = new BigDecimal(rate.getQuantity().getValue()); BigDecimal subtotal = bigDecQty.multiply(bigDecRate); return subtotal; }
From source file:io.github.jeddict.jaxb.spec.validator.JaxbMetadataValidator.java
public static boolean isEmpty(JaxbMetadata jaxbMetadata) { return StringUtils.isBlank(jaxbMetadata.getName()) && StringUtils.isBlank(jaxbMetadata.getNamespace()) && StringUtils.isBlank(jaxbMetadata.getDefaultValue()) && jaxbMetadata.getNillable() && jaxbMetadata.getRequired(); }
From source file:com.github.slugify.Slugify.java
private static String normalize(String input) { String ret = StringUtils.trim(input); if (StringUtils.isBlank(ret)) { return ""; }/*from www . j av a2s . c om*/ ret = ret.replace("", "ss"); return Normalizer.normalize(ret, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "") .replaceAll("[^a-zA-Z0-9 ]", ""); }