List of usage examples for org.apache.commons.lang3 StringUtils capitalize
public static String capitalize(final String str)
Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .
From source file:com.github.kennycyb.uifactory.core.factory.impl.components.swing.JButtonFactory.java
@Override public void initialize(final ComponentContext context) { super.initialize(context); final JButton component = (JButton) context.getComponent(); if (component.getText() == null || component.getText().length() == 0) { component.setText(StringUtils.capitalize(context.getId())); }/*from w w w .j ava 2s . c om*/ }
From source file:com.nexmo.client.voice.VoiceName.java
@JsonValue @Override//from w w w . j a v a 2s.co m public String toString() { //API requires voice_name to be sent with first character upper cased return StringUtils.capitalize(name().toLowerCase()); }
From source file:edu.taru.common.utils.Reflections.java
public static void invokeSetter(Object obj, String propertyName, Class<?> parameterTypes, Object value) throws InstantiationException, IllegalAccessException { Object object = obj;//w w w . jav a 2 s . co m String[] names = StringUtils.split(propertyName, "."); for (int i = 0; i < names.length; i++) { if (i < names.length - 1) { String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); if (null == object) { object = parameterTypes.newInstance(); } } else { String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); invokeMethodByName(object, setterMethodName, new Object[] { value }); } } }
From source file:com.skelril.skree.content.modifier.ModExtendCommand.java
@Override public CommandResult execute(CommandSource src, CommandContext args) throws CommandException { Optional<ModifierService> optService = Sponge.getServiceManager().provide(ModifierService.class); if (!optService.isPresent()) { src.sendMessage(Text.of(TextColors.DARK_RED, "Modifier service not found.")); return CommandResult.empty(); }//from w ww . j av a 2 s . c o m ModifierService service = optService.get(); String modifier = args.<String>getOne("modifier").get(); int minutes = args.<Integer>getOne("minutes").get(); boolean wasActive = service.isActive(modifier); service.extend(modifier, TimeUnit.MINUTES.toMillis(minutes)); String friendlyName = StringUtils.capitalize(modifier.replace("_", " ").toLowerCase()); String friendlyTime = PrettyText.date(service.expiryOf(modifier)); String change = wasActive ? " extended" : " enabled"; String rawMessage = friendlyName + change + " till " + friendlyTime + "!"; MessageChannel.TO_ALL.send(Text.of(TextColors.GOLD, rawMessage)); GameChatterPlugin.inst().sendSystemMessage(rawMessage); return CommandResult.success(); }
From source file:com.mirth.connect.model.alert.AlertAction.java
@Override public void migrate3_2_0(DonkeyElement element) { DonkeyElement protocol = element.getChildElement("protocol"); if (protocol != null) { protocol.setTextContent(StringUtils.capitalize(protocol.getTextContent().toLowerCase())); }//from w w w . j a v a 2s . c o m }
From source file:com.iorga.iraj.json.ObjectContextCaller.java
public ObjectContextCaller(final Class<?> currentClass, final String currentContextPath) throws SecurityException { final String firstContextPathPart = StringUtils.substringBefore(currentContextPath, "."); try {//from w w w . j ava 2s . com getter = currentClass.getMethod("get" + StringUtils.capitalize(firstContextPathPart)); } catch (final NoSuchMethodException e) { try { getter = currentClass.getMethod("is" + StringUtils.capitalize(firstContextPathPart)); } catch (final NoSuchMethodException e1) { throw new IllegalArgumentException("No getter for " + firstContextPathPart + " on " + currentClass); } } if (!firstContextPathPart.equals(currentContextPath)) { // the path is not finished to handle nextContextCaller = new ObjectContextCaller(getter.getReturnType(), StringUtils.substringAfter(currentContextPath, ".")); } else { nextContextCaller = null; } }
From source file:com.nike.cerberus.auth.connector.okta.OktaClientResponseUtilsTest.java
@Test public void getDeviceName() { String provider = "provider"; Factor factor = mock(Factor.class); when(factor.getProvider()).thenReturn(provider); String result = this.oktaClientResponseUtils.getDeviceName(factor); assertEquals(StringUtils.capitalize(provider), result); }
From source file:net.rptools.gui.listeners.fxml.AbstractURLController.java
@Override protected void init() { getURLList().getSelectionModel().setSelectionMode(SelectionMode.SINGLE); final List<AssetTableRow> urlRows = stateToGui(); getURLList().setItems(FXCollections.observableList(urlRows)); final String prefix = BOX + StringUtils.capitalize(getPrefix()); LOGGER.debug("prefix={}", prefix); final TextInputControl name = ((TextInputControl) lookup(prefix + "Name")); final TextInputControl location = ((TextInputControl) lookup(prefix + "Location")); final BooleanBinding empty = name.textProperty().isEmpty().or(location.textProperty().isEmpty()); lookup(prefix + "New").disableProperty().bind(empty); }
From source file:com.cryart.sabbathschool.viewmodel.SSReadingListItemViewModel.java
public String getDate() { return StringUtils.capitalize(DateTimeFormat.forPattern(SSConstants.SS_DATE_FORMAT_OUTPUT) .print(DateTimeFormat.forPattern(SSConstants.SS_DATE_FORMAT).parseLocalDate(ssDay.date))); }
From source file:com.thoughtworks.go.config.AbstractTask.java
public String getConditionsForDisplay() { if (runIfConfigs.isEmpty()) { return StringUtils.capitalize(RunIfConfig.PASSED.toString()); }// w w w .j ava2s . co m List<String> capitalized = runIfConfigs.stream().map(f -> StringUtils.capitalize(f.toString())) .collect(Collectors.toList()); return StringUtils.join(capitalized, ", "); }