List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:org.openmrs.module.household.model.editor.HouseholdEncounterTypeEditor.java
/** * @should set using id// w w w .j av a 2s. c o m * @should set using uuid */ public void setAsText(String text) throws IllegalArgumentException { HouseholdService hs = Context.getService(HouseholdService.class); if (StringUtils.hasText(text)) { try { setValue(hs.getHouseholdEncounterType(Integer.valueOf(text))); } catch (Exception ex) { HouseholdEncounterType householdET = hs.getHouseholdEncounterTypeByUuid(text); setValue(householdET); if (householdET == null) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("Household Encounter Type not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:com.ryantenney.metrics.spring.config.MetricRegistryBeanDefinitionParser.java
@Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { final Object source = parserContext.extractSource(element); final String name = element.getAttribute("name"); if (StringUtils.hasText(name)) { final BeanDefinitionBuilder beanDefBuilder = build(SharedMetricRegistries.class, source); beanDefBuilder.setFactoryMethod("getOrCreate"); beanDefBuilder.addConstructorArgValue(name); return beanDefBuilder.getBeanDefinition(); } else {/*from w w w .ja v a 2s. c o m*/ return build(MetricRegistry.class, source).getBeanDefinition(); } }
From source file:org.spring.data.gemfire.app.beans.Programmer.java
public String getProgrammingLanguage() { return (StringUtils.hasText(programmingLanguage) ? programmingLanguage : DEFAULT_PROGRAMMING_LANGUAGE); }
From source file:biz.c24.io.spring.integration.config.XPathTransformerParser.java
@Override protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String expression = element.getAttribute("xpath-statement"); String expressionRef = element.getAttribute("xpath-statement-ref"); boolean hasRef = StringUtils.hasText(expressionRef); Assert.isTrue(hasRef ^ StringUtils.hasText(expression), "Exactly one of the 'xpath-statement' or 'xpath-statement-ref' attributes is required."); if (hasRef) { builder.addConstructorArgReference(expressionRef); } else {//from ww w .jav a2 s. com builder.addConstructorArgValue(expression); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "evaluation-type"); }
From source file:nz.co.senanque.schemabuilder.SchemaBuilderTask.java
public void execute() { registerDriver();//from w w w. j a v a 2 s . co m m_schemaName = (!StringUtils.hasText(m_schemaName)) ? "%" : m_schemaName; TypeMapper typeMapper = new TypeMapper(); if (StringUtils.hasText(m_typeFile)) { Properties types = new Properties(); try { types.load(new FileReader(m_typeFile)); } catch (IOException e) { throw new RuntimeException("Failed to open typeFile", e); } typeMapper.addTypes(types); } SchemaBuilder schemaBuilder = new SchemaBuilder(m_schemaName, m_outFileName, typeMapper); Connection connection = null; try { connection = getJDBCConnection(m_user, m_password); } catch (Exception e) { throw new RuntimeException("Failed to connect to database", e); } try { schemaBuilder.build(connection); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.phoenixnap.oss.ramlapisync.javadoc.FieldVisitor.java
@Override public void visit(FieldDeclaration n, String arg) { // here you can access the attributes of the method. // this method will be called for all methods in this // CompilationUnit, including inner class methods String javaDocContent = ""; if (n.getComment() != null && n.getComment().getContent() != null) { javaDocContent = NamingHelper.cleanLeadingAndTrailingNewLineAndChars(n.getComment().getContent()); }// w w w . j a v a 2 s . co m if (StringUtils.hasText(javaDocContent) && n.getVariables() != null && n.getVariables().size() > 0) { javaDoc.setJavaDoc(n.getVariables().get(0).getId().getName(), javaDocContent); } }
From source file:net.nicoll.boot.metadata.AbstractMetadataFormatter.java
protected String extractTagLine(ConfigurationMetadataProperty property, String defaultValue) { String description = property.getDescription(); if (StringUtils.hasText(description)) { BreakIterator breakIterator = BreakIterator.getSentenceInstance(); breakIterator.setText(description); return description.substring(breakIterator.first(), breakIterator.next()); }//from w w w . jav a 2 s. c om return defaultValue; }
From source file:com.consol.citrus.admin.service.executor.maven.MavenRunTestsCommand.java
@Override protected String getLifeCycleCommand() { String commandLine = getBuildConfiguration().isUseClean() ? CLEAN : ""; if (StringUtils.hasText(getBuildConfiguration().getCommand())) { return commandLine + getBuildConfiguration().getCommand() + " "; } else if (getBuildConfiguration().getTestPlugin().equals("maven-failsafe")) { return commandLine + COMPILE + INTEGRATION_TEST; } else if (getBuildConfiguration().getTestPlugin().equals("maven-surefire")) { return commandLine + COMPILE + TEST; }/*from w w w . ja v a2 s . c o m*/ return commandLine; }
From source file:nz.co.senanque.madura.spring.ConfigurationBeanDefinitionParser.java
protected void doParse(Element element, BeanDefinitionBuilder bean) { String source = element.getAttribute("source"); if (StringUtils.hasText(source)) { bean.addPropertyReference("configuration", source); }//from w ww.ja v a2s .c o m bean.setInitMethodName("init"); }
From source file:org.springdata.ehcache.config.xml.CacheManagerParser.java
@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { String id = super.resolveId(element, definition, parserContext); return StringUtils.hasText(id) ? id : ConfigConstants.CACHE_MANAGER_DEFAULT_ID; }