List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:com.github.britter.beanvalidators.strings.JavaNumberConstraintValidator.java
@Override public boolean isValid(final String value, final ConstraintValidatorContext context) { // Don't validate null, empty and blank strings, since these are validated by @NotNull, @NotEmpty and @NotBlank return StringUtils.isBlank(value) || NumberUtils.isNumber(value); }
From source file:org.kuali.coeus.s2sgen.impl.hash.GrantApplicationHashServiceImpl.java
@Override public String computeGrantFormsHash(String xml) { if (StringUtils.isBlank(xml)) { throw new IllegalArgumentException("xml is blank"); }/*from w w w . j a va 2s . c o m*/ return GrantApplicationHash.computeGrantFormsHash(xml); }
From source file:com.mirth.connect.client.ui.StatusBar.java
/** Creates new form StatusBar */ public StatusBar() { initComponents();//from www .j ava 2 s. co m workingText.setText(""); StringBuilder statusBarText = new StringBuilder(); statusBarText.append("Connected to: "); if (!StringUtils.isBlank(PlatformUI.SERVER_NAME)) { statusBarText.append(PlatformUI.SERVER_NAME + " | "); } statusBarText.append(PlatformUI.SERVER_URL); serverLabel.setText(statusBarText.toString()); serverLabel .setIcon(new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/server.png"))); progressBar.setEnabled(false); progressBar.setForeground(UIConstants.JX_CONTAINER_BACKGROUND_COLOR); this.setBorder(new BevelBorder(BevelBorder.LOWERED)); }
From source file:com.trenako.validation.ISOCountryValidator.java
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; }// w w w. j ava 2 s . c o m return Arrays.binarySearch(Locale.getISOCountries(), value.toUpperCase()) >= 0; }
From source file:com.josue.lottery.eap.persistence.entity.rest.Resource.java
@PrePersist public void generateUuid() { if (StringUtils.isBlank(uuid)) { this.uuid = UUID.randomUUID().toString(); this.dateCreated = new Timestamp(new Date().getTime()); } else {// w ww . j av a 2 s. c o m this.dateUpdated = new Timestamp(new Date().getTime()); } }
From source file:com.mirth.connect.server.attachments.identity.IdentityAttachmentHandlerProvider.java
@Override public void setProperties(Channel channel, AttachmentHandlerProperties attachmentProperties) { mimeType = attachmentProperties.getProperties().get("identity.mimetype"); if (StringUtils.isBlank(mimeType)) { mimeType = "text/plain"; }//from ww w . ja v a2 s . c o m }
From source file:com.threewks.thundr.view.json.JsonView.java
private void applyDefaults() { if (StringUtils.isBlank(getContentType())) { withContentType(MimeTypes.MIME_APPLICATION_JSON); }/*from ww w . ja v a 2 s . co m*/ if (StringUtils.isBlank(getCharacterEncoding())) { withCharacterEncoding(StringPool.UTF_8); } if (getStatusCode() == null) { withStatusCode(HttpServletResponse.SC_OK); } }
From source file:com.erudika.para.i18n.MockCurrencyConverter.java
@Override public Double convertCurrency(Number amount, String from, String to) { if (amount == null || StringUtils.isBlank(from) || StringUtils.isBlank(to)) { return 0.0; }/*from w w w. j a v a2s .c om*/ Double f = rates.containsKey(from) ? rates.get(from) : 1.0; Double t = rates.containsKey(to) ? rates.get(to) : 1.0; double ratio = t / f; return amount.doubleValue() * ratio; }
From source file:com.trenako.validation.ISOLanguageValidator.java
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; }// w w w . jav a 2s . c om return Arrays.binarySearch(Locale.getISOLanguages(), value.toLowerCase()) >= 0; }
From source file:com.sensedia.transparencia.client.core.TransparenciaClientIT.java
public TransparenciaClientIT() { try {//from ww w .j ava2s. c o m Properties properties = new Properties(); properties.load(getClass().getResourceAsStream("/test-token.properties")); String foundToken = properties.getProperty("App-token"); if (!StringUtils.isBlank(foundToken)) { client = new TransparenciaClient(foundToken); } else { throw new RuntimeException("Nenhum App-token encontrado, verifique nos recursos de teste"); } } catch (IOException ex) { Logger.getLogger(APIRequestIT.class.getName()).log(Level.SEVERE, null, ex); } }