List of usage examples for org.apache.commons.lang3 StringUtils isNotBlank
public static boolean isNotBlank(final CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
StringUtils.isNotBlank(null) = false StringUtils.isNotBlank("") = false StringUtils.isNotBlank(" ") = false StringUtils.isNotBlank("bob") = true StringUtils.isNotBlank(" bob ") = true
From source file:com.dtstack.jlogstash.assembly.CmdLineParams.java
public static double getOutputQueueCoefficient() { String number = line.getOptionValue("i"); double coefficient = StringUtils.isNotBlank(number) ? Double.parseDouble(number) : SystemProperty.getOutputProportion(); logger.warn("output queue coefficient:{}", String.valueOf(coefficient)); return coefficient; }
From source file:io.fabric8.maven.core.util.VersionUtil.java
private static Integer tryParseInteger(String text) { if (StringUtils.isNotBlank(text)) { try {/*from w w w .j av a2 s . c om*/ return Integer.parseInt(text); } catch (NumberFormatException e) { // ignore } } return null; }
From source file:br.ufac.sion.converter.LocalidadeConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Localidade retorno = null;/*from w ww.j a v a 2 s . c o m*/ if (StringUtils.isNotBlank(value)) { retorno = this.localidadeFacade.findById(new Long(value)); if (retorno == null) { String descricaoErro = "A Localidade no existe."; FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, descricaoErro, descricaoErro); throw new ConverterException(message); } } return retorno; }
From source file:mobile.vo.user.User.java
public static User create(Expert e) { User topUser = new User(); topUser.setAvatar_190(e.getFullHeadUrl()); topUser.setAverageScore(e.getAverageScoreWithDefault()); topUser.setCommentNum(e.getCommentNumWithDefault()); topUser.setCountry(e.country);//from www . ja va 2s . c o m topUser.setGender(e.getGenderWithDefault().ordinal()); topUser.setJob(e.job); topUser.setOnlineState(UserService.getOnlineState(e.userId)); topUser.setPayType(e.getPayTypeWithDefault().ordinal()); topUser.setPersonalInfo(e.personalInfo); if (StringUtils.isNotBlank(e.skillsTags)) { topUser.setSkillsTags(e.skillsTags); } topUser.setUserId(e.userId); topUser.setUserName(e.userName); topUser.setExpenses(e.getExpensesWithDefault()); return topUser; }
From source file:com.openlattice.mail.config.HtmlEmailTemplate.java
public HtmlEmailTemplate(String templateId, String template) { checkArgument(StringUtils.isNotBlank(templateId), "TemplateId cannot be blank."); checkArgument(StringUtils.isNotBlank(template), "Template cannot be blank."); this.templateId = templateId; this.template = template; }
From source file:com.thinkbiganalytics.policy.precondition.AvailablePolicies.java
/** * Find all classes annotated with {@link PreconditionPolicy} and transfrom them into the user interface object * * @return user interface objects of the {@link PreconditionPolicy} on the classpath */// w w w. j a va 2s . c o m public static List<PreconditionRule> discoverPreconditions() { List<PreconditionRule> rules = new ArrayList<>(); Set<Class<?>> validators = ReflectionPolicyAnnotationDiscoverer .getTypesAnnotatedWith(PreconditionPolicy.class); for (Class c : validators) { PreconditionPolicy policy = (PreconditionPolicy) c.getAnnotation(PreconditionPolicy.class); String desc = policy.description(); String shortDesc = policy.shortDescription(); if (StringUtils.isBlank(desc) && StringUtils.isNotBlank(shortDesc)) { desc = shortDesc; } if (StringUtils.isBlank(shortDesc) && StringUtils.isNotBlank(desc)) { shortDesc = desc; } List<FieldRuleProperty> properties = PreconditionAnnotationTransformer.instance().getUiProperties(c); rules.add(new PreconditionRuleBuilder(policy.name()).description(desc).shortDescription(shortDesc) .addProperties(properties).objectClassType(c).build()); } return rules; }
From source file:dao.SchemaDatasetRowMapper.java
@Override public SchemaDataset mapRow(ResultSet rs, int rowNum) throws SQLException { int id = rs.getInt(DATASET_ID_COLUMN); String urn = rs.getString(URN_COLUMN); String name = ""; if (StringUtils.isNotBlank(urn)) { int index = urn.lastIndexOf('/'); if (index != -1) { name = urn.substring(index + 1); }//w w w. jav a2 s .c om } String modified = rs.getString(MODIFIED_DATE_COLUMN); SchemaDataset schemaDataset = new SchemaDataset(); schemaDataset.id = id; schemaDataset.urn = urn; schemaDataset.lastModified = modified; schemaDataset.name = name; schemaDataset.datasetLink = DATASET_LINK_PREFIX + id; return schemaDataset; }
From source file:edu.usu.sdl.openstorefront.service.manager.SolrManager.java
public static void init() { String url = PropertiesManager.getValue(PropertiesManager.KEY_SOLR_URL); if (StringUtils.isNotBlank(url)) { log.log(Level.INFO, MessageFormat.format("Connecting to Solr at {0}", url)); solrServer = new HttpSolrServer(url); } else {//from w ww . ja va 2s . c o m log.log(Level.WARNING, "Solr property (" + PropertiesManager.KEY_SOLR_URL + ") is not set in openstorefront.properties. Search service unavailible. Using Mock"); solrServer = new SolrServer() { @Override public NamedList<Object> request(SolrRequest request) throws SolrServerException, IOException { NamedList<Object> results = new NamedList<>(); log.log(Level.INFO, "Mock Solr recieved request: " + request); return results; } @Override public void shutdown() { //do nothing } }; } }
From source file:com.github.rvesse.airline.types.numerics.NumericCandidate.java
public boolean hasSuffix() { return StringUtils.isNotBlank(this.suffix); }
From source file:br.ufac.sion.inscricao.converter.OrgaoExpedidorConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { OrgaoExpedidor retorno = null;// w w w . j a v a2s.com if (StringUtils.isNotBlank(value)) { retorno = this.orgaoExpedidorFacade.findById(new Long(value)); if (retorno == null) { String descricaoErro = "A Orgo Expedidor no existe."; FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, descricaoErro, descricaoErro); throw new ConverterException(message); } } return retorno; }