List of usage examples for org.apache.commons.lang3 StringUtils upperCase
public static String upperCase(final String str)
Converts a String to upper case as per String#toUpperCase() .
A null input String returns null .
StringUtils.upperCase(null) = null StringUtils.upperCase("") = "" StringUtils.upperCase("aBc") = "ABC"
Note: As described in the documentation for String#toUpperCase() , the result of this method is affected by the current locale.
From source file:io.wcm.maven.plugins.i18n.TransformMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { OutputFormat selectedOutputFormat = OutputFormat.valueOf(StringUtils.upperCase(outputFormat)); try {/* w w w . j ava 2 s .c o m*/ intialize(); List<File> sourceFiles = getI18nSourceFiles(); for (File file : sourceFiles) { try { // transform i18n files String languageKey = FileUtils.removeExtension(file.getName()); I18nReader reader = getI18nReader(file); SlingI18nMap i18nMap = new SlingI18nMap(languageKey, reader.read(file)); // write mappings to target file File targetFile = getTargetFile(file, selectedOutputFormat); writeTargetI18nFile(i18nMap, targetFile, selectedOutputFormat); getLog().info("Transformed " + file.getPath() + " to " + targetFile.getPath()); } catch (IOException | JSONException ex) { throw new MojoFailureException("Unable to transform i18n resource: " + file.getPath(), ex); } } } catch (IOException ex) { throw new MojoFailureException("Failure to transform i18n resources", ex); } }
From source file:com.threewks.thundr.http.SyntheticHttpServletResponse.java
@Override public void setCharacterEncoding(String charset) { this.characterEncoding = StringUtils.trimToNull(StringUtils.upperCase(charset)); }
From source file:com.hengyi.japp.sap.convert.impl.SapConverts.java
private String getSapFieldName(PropertyDescriptor descriptor) { Method readMethod = descriptor.getReadMethod(); SapConvertField scf = readMethod.getAnnotation(SapConvertField.class); if (scf != null) { return StringUtils.upperCase(scf.value()); }//from www . j av a 2 s.c om if (readMethod.getAnnotation(SapTransient.class) != null) { return null; } String beanPropertyName = descriptor.getName(); for (Field field : beanClass.getDeclaredFields()) { if (!field.getName().equals(beanPropertyName)) { continue; } if (field.getAnnotation(SapTransient.class) != null) { return null; } scf = field.getAnnotation(SapConvertField.class); if (scf != null) { return StringUtils.upperCase(scf.value()); } } return StringUtils.upperCase(beanPropertyName); }
From source file:com.xpn.xwiki.web.sx.SxDocumentSource.java
/** * {@inheritDoc}// www . ja va 2 s. c o m * * @see SxSource#getCachePolicy() */ public CachePolicy getCachePolicy() { CachePolicy finalCache = CachePolicy.LONG; if (this.document.getObjects(this.extension.getClassName()) != null) { for (BaseObject sxObj : this.document.getObjects(this.extension.getClassName())) { if (sxObj == null) { continue; } try { CachePolicy cache = CachePolicy.valueOf(StringUtils.upperCase( StringUtils.defaultIfEmpty(sxObj.getStringValue(CACHE_POLICY_PROPERTY_NAME), "LONG"))); if (cache.compareTo(finalCache) > 0) { finalCache = cache; } } catch (Exception ex) { LOGGER.warn("SX object [{}#{}] has an invalid cache policy: [{}]", new Object[] { this.document.getFullName(), sxObj.getStringValue("name"), sxObj.getStringValue(CACHE_POLICY_PROPERTY_NAME) }); } } } return finalCache; }
From source file:com.hurence.logisland.engine.vanilla.stream.kafka.KafkaStreamsPipelineStream.java
@Override public void init(ComponentContext context) { super.init(context); StreamContext streamContext = (StreamContext) context; Topology topology = new Topology(); Properties properties = new Properties(); String streamId = streamContext.getStream().getIdentifier(); String sourceId = "source_" + streamId; String pipelineId = "pipeline_" + streamId; String sinkId = "sink_" + streamId; properties.put(StreamProperties.PROPERTY_APPLICATION_ID.getName(), streamId); properties.put(StreamProperties.PROPERTY_BOOTSTRAP_SERVERS.getName(), streamContext.getPropertyValue(StreamProperties.PROPERTY_BOOTSTRAP_SERVERS).asString()); context.getProperties().forEach((propertyDescriptor, s) -> { if (propertyDescriptor.isDynamic()) { properties.put(propertyDescriptor.getName(), s); }/* ww w .j a v a 2s .c om*/ }); topology.addSource( Topology.AutoOffsetReset.valueOf(StringUtils.upperCase( streamContext.getPropertyValue(StreamProperties.KAFKA_MANUAL_OFFSET_RESET).asString())), sourceId, streamContext.getPropertyValue(StreamProperties.READ_TOPICS).asString().split(",")) .addProcessor(pipelineId, () -> new LogislandPipelineProcessor(streamContext), sourceId); for (String outTopic : streamContext.getPropertyValue(StreamProperties.WRITE_TOPICS).asString() .split(",")) { topology.addSink(sinkId + "_" + outTopic, outTopic, new ByteArraySerializer(), new ByteArraySerializer(), pipelineId); } streams = new KafkaStreams(topology, properties); }
From source file:com.norconex.importer.handler.tagger.impl.CharacterCaseTagger.java
@Override public void tagApplicableDocument(String reference, InputStream document, ImporterMetadata metadata, boolean parsed) throws ImporterHandlerException { for (String fieldName : fieldCases.keySet()) { String type = fieldCases.get(fieldName); List<String> values = metadata.getStrings(fieldName); if (values != null) { for (int i = 0; i < values.size(); i++) { String value = values.get(i); if (CASE_UPPER.equals(type)) { values.set(i, StringUtils.upperCase(value)); } else if (CASE_LOWER.equals(type)) { values.set(i, StringUtils.lowerCase(value)); } else if (CASE_WORDS.equals(type)) { values.set(i, WordUtils.capitalizeFully(value)); } else { LOG.warn("Unsupported character case type: " + type); }/* w ww. j a v a 2 s .c o m*/ } metadata.setString(fieldName, values.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); } } }
From source file:com.zhumeng.dream.security.ShiroDbRealm.java
/** * ??./*from w w w . j a v a2s . c o m*/ * @author: * @param token * @return */ protected boolean validateCaptcha(CaptchaUsernamePasswordToken token) { String captchaID = (String) SecurityUtils.getSubject().getSession().getId(); String challengeResponse = StringUtils.upperCase(token.getCaptcha()); if (log.isDebugEnabled()) log.debug("??: captchaID =" + captchaID + ";challengeResponse=" + challengeResponse); return captchaServices.validateResponseForID(captchaID, challengeResponse); }
From source file:de.knightsoftnet.validators.shared.impl.PhoneNumberValueRestValidator.java
/** * {@inheritDoc} check if given string is a valid gln. * * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, * javax.validation.ConstraintValidatorContext) *//*w w w.j ava 2 s . co m*/ @Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } try { String countryCode = BeanUtils.getProperty(pvalue, this.fieldCountryCode); final String phoneNumber = BeanUtils.getProperty(pvalue, this.fieldPhoneNumber); if (StringUtils.isEmpty(phoneNumber)) { return true; } if (this.allowLowerCaseCountryCode) { countryCode = StringUtils.upperCase(countryCode); } final String url = StringUtils .removeEnd(StringUtils.removeEnd(StringUtils.removeEnd(GWT.getModuleBaseURL(), "/"), GWT.getModuleName()), "/") + PhoneNumber.ROOT + PhoneNumber.VALIDATE // + "?" + Parameters.COUNTRY + "=" + countryCode // + "&" + Parameters.PHONE_NUMBER + "=" + this.urlEncode(phoneNumber) // + "&" + Parameters.DIN_5008 + "=" + PhoneNumberValueRestValidator.this.allowDin5008 // + "&" + Parameters.E123 + "=" + PhoneNumberValueRestValidator.this.allowE123 // + "&" + Parameters.URI + "=" + PhoneNumberValueRestValidator.this.allowUri // + "&" + Parameters.MS + "=" + PhoneNumberValueRestValidator.this.allowMs // + "&" + Parameters.COMMON + "=" + PhoneNumberValueRestValidator.this.allowCommon; final String restResult = CachedSyncHttpGetCall.syncRestCall(url); if (StringUtils.equalsIgnoreCase("TRUE", restResult)) { return true; } this.switchContext(pcontext); return false; } catch (final Exception ignore) { this.switchContext(pcontext); return false; } }
From source file:com.callidusrobotics.irc.BotProperties.java
public IrcColor getFontColor() { return IrcColor.valueOf(StringUtils.upperCase(getProperty(BotPropertyKey.FONT_COLOR))); }
From source file:com.norconex.collector.core.spoil.impl.GenericSpoiledReferenceStrategizer.java
private SpoiledReferenceStrategy toStrategy(String strategy) { return EnumUtils.getEnum(SpoiledReferenceStrategy.class, StringUtils.upperCase(strategy)); }