Java Code Examples for org.apache.commons.lang.WordUtils#capitalizeFully()
The following examples show how to use
org.apache.commons.lang.WordUtils#capitalizeFully() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NameSuffixAspect.java From openregistry with Apache License 2.0 | 6 votes |
@Around("set(@org.openregistry.core.domain.normalization.NameSuffix * *)") public Object transformFieldValue(final ProceedingJoinPoint joinPoint) throws Throwable { final String value = (String) joinPoint.getArgs()[0]; if (isDisabled() || value == null || value.isEmpty()) { return joinPoint.proceed(); } final String overrideValue = getCustomMapping().get(value); if (overrideValue != null) { return joinPoint.proceed(new Object[] {overrideValue}); } final String casifyValue; if (value.matches("^[IiVv]+$")) { //TODO Generalize II - VIII casifyValue = value.toUpperCase(); } else { casifyValue = WordUtils.capitalizeFully(value); } return joinPoint.proceed(new Object[] {casifyValue}); }
Example 2
Source File: Converter.java From NametagEdit with GNU General Public License v3.0 | 6 votes |
private void handleGroup(YamlConfiguration config, String line) { String[] lineContents = line.replace("=", "").split(" "); String[] permissionSplit = lineContents[0].split("\\."); String group = WordUtils.capitalizeFully(permissionSplit[permissionSplit.length - 1]); String permission = lineContents[0]; String type = lineContents[1]; String value = line.substring(line.indexOf("\"") + 1); value = value.substring(0, value.indexOf("\"")); config.set("Groups." + group + ".Permission", permission); config.set("Groups." + group + ".SortPriority", -1); if (type.equals("prefix")) { config.set("Groups." + group + ".Prefix", value); } else { config.set("Groups." + group + ".Suffix", value); } }
Example 3
Source File: ScoreboardModule.java From CardinalPGM with MIT License | 6 votes |
public void renderObjective(GameObjective objective) { if (!objective.showOnScoreboard()) return; int score = currentScore; Team team = scoreboard.getTeam(objective.getScoreboardHandler().getNumber() + "-o"); String prefix = objective.getScoreboardHandler().getPrefix(this.team); team.setPrefix(prefix); if (team.getEntries().size() > 0) { setScore(this.objective, new ArrayList<>(team.getEntries()).get(0), score); } else { String raw = (objective instanceof HillObjective ? "" : ChatColor.RESET) + " " + WordUtils.capitalizeFully(objective.getName().replaceAll("_", " ")); while (used.contains(raw)) { raw = raw + ChatColor.RESET; } team.addEntry(raw); setScore(this.objective, raw, score); used.add(raw); } currentScore++; }
Example 4
Source File: BeltColumnStatisticsPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Updates the generic gui elements. */ private void updateGenericElements(final AbstractBeltColumnStatisticsModel model) { String attLabel = model.getColumnName(); ColumnRole role = model.getTableOrNull().getFirstMetaData(model.getColumnName(), ColumnRole.class); String attRole = role == null ? null : role.toString().toLowerCase(Locale.ENGLISH); Column column = model.getTableOrNull().column(model.getColumnName()); String valueTypeString = WordUtils.capitalizeFully(column.type().id().toString().toLowerCase(Locale.ENGLISH)); if (column.type().id() == Column.TypeId.NOMINAL && column.getDictionary().isBoolean()) { valueTypeString = "Binominal"; } labelAttHeader.setText(attRole == null || attRole.isEmpty() ? " " : Character.toUpperCase(attRole.charAt(0)) + attRole.substring(1)); labelAttHeader.setForeground(AttributeGuiTools.getColorForAttributeRole(mapAttributeRoleName(), ColorScope.BORDER)); panelAttName.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, AttributeGuiTools.getColorForAttributeRole(mapAttributeRoleName(), ColorScope.CONTENT))); labelAttName.setText(attLabel); labelAttName.setToolTipText(attLabel); labelAttType.setText(valueTypeString); labelAttType.setIcon(null); labelStatsMissing.setText(Tools.formatIntegerIfPossible(model.getNumberOfMissingValues(), 0)); labelStatsMissing.setToolTipText(labelStatsMissing.getText()); }
Example 5
Source File: WeatherPublisher.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * Publishes the item with the value. */ private void publishValue(String itemName, Object value, WeatherBindingConfig bindingConfig) { if (value == null) { context.getEventPublisher().postUpdate(itemName, UnDefType.UNDEF); } else if (value instanceof Calendar) { Calendar calendar = (Calendar) value; context.getEventPublisher().postUpdate(itemName, new DateTimeType(calendar)); } else if (value instanceof Number) { context.getEventPublisher().postUpdate(itemName, new DecimalType(round(value.toString(), bindingConfig))); } else if (value instanceof String || value instanceof Enum) { if (value instanceof Enum) { String enumValue = WordUtils.capitalizeFully(StringUtils.replace(value.toString(), "_", " ")); context.getEventPublisher().postUpdate(itemName, new StringType(enumValue)); } else { context.getEventPublisher().postUpdate(itemName, new StringType(value.toString())); } } else { logger.warn("Unsupported value type {}", value.getClass().getSimpleName()); } }
Example 6
Source File: PlaceholderNotificationGenerator.java From mxisd with GNU Affero General Public License v3.0 | 5 votes |
protected String populateForCommon(ThreePid recipient, String input) { if (StringUtils.isBlank(input)) { return input; } String domainPretty = WordUtils.capitalizeFully(mxCfg.getDomain()); return input .replace("%DOMAIN%", mxCfg.getDomain()) .replace("%DOMAIN_PRETTY%", domainPretty) .replace("%RECIPIENT_MEDIUM%", recipient.getMedium()) .replace("%RECIPIENT_MEDIUM_URL_ENCODED%", RestClientUtils.urlEncode(recipient.getMedium())) .replace("%RECIPIENT_ADDRESS%", recipient.getAddress()) .replace("%RECIPIENT_ADDRESS_URL_ENCODED%", RestClientUtils.urlEncode(recipient.getAddress())); }
Example 7
Source File: ObserverModule.java From CardinalPGM with MIT License | 5 votes |
public Inventory getFakeInventory(Player player, String locale) { Inventory inventory = Bukkit.createInventory(null, 45, player.getDisplayName().length() > 32 ? Teams.getTeamColorByPlayer(player) + player.getName() : player.getDisplayName()); inventory.setItem(0, player.getInventory().getHelmet()); inventory.setItem(1, player.getInventory().getChestplate()); inventory.setItem(2, player.getInventory().getLeggings()); inventory.setItem(3, player.getInventory().getBoots()); inventory.setItem(4, player.getInventory().getItemInOffHand()); ItemStack potion; if (player.getActivePotionEffects().size() > 0){ ArrayList<String> effects = new ArrayList<>(); for (PotionEffect effect : player.getActivePotionEffects()) { String effectName = WordUtils.capitalizeFully(effect.getType().getName().toLowerCase().replaceAll("_", " ")); effects.add(ChatColor.YELLOW + effectName + " " + (effect.getAmplifier() + 1)); } potion = Items.createItem(Material.POTION, 1, (short) 0, ChatColor.AQUA + "" + ChatColor.ITALIC + new LocalizedChatMessage(ChatConstant.UI_POTION_EFFECTS).getMessage(locale), effects); } else { potion = Items.createItem(Material.GLASS_BOTTLE, 1, (short) 0, ChatColor.AQUA + "" + ChatColor.ITALIC + new LocalizedChatMessage(ChatConstant.UI_POTION_EFFECTS).getMessage(locale), new ArrayList<>(Collections.singletonList(ChatColor.YELLOW + new LocalizedChatMessage(ChatConstant.UI_NO_POTION_EFFECTS).getMessage(locale)))); } inventory.setItem(6, potion); ItemStack food = Items.createItem(Material.COOKED_BEEF, player.getFoodLevel(), (short) 0, ChatColor.AQUA + "" + ChatColor.ITALIC + new LocalizedChatMessage(ChatConstant.UI_HUNGER_LEVEL).getMessage(locale)); inventory.setItem(7, food); ItemStack health = Items.createItem(Material.REDSTONE, (int) Math.ceil(player.getHealth()), (short) 0, ChatColor.AQUA + "" + ChatColor.ITALIC + new LocalizedChatMessage(ChatConstant.UI_HEALTH_LEVEL).getMessage(locale)); inventory.setItem(8, health); for (int i = 36; i <= 44; i++) { inventory.setItem(i, player.getInventory().getItem(i - 36)); } for (int i = 9; i <= 35; i++) { inventory.setItem(i, player.getInventory().getItem(i)); } return inventory; }
Example 8
Source File: ExprStringCase.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("null") private static String toCamelCase(String str, boolean strict) { String[] words = str.split(" "); // Splits at spaces String buf = words.length > 0 ? (strict ? words[0].toLowerCase() : WordUtils.uncapitalize(words[0])) : ""; for (int i = 1; i < words.length; i++) buf += strict ? WordUtils.capitalizeFully(words[i]) : WordUtils.capitalize(words[i]); return buf; }
Example 9
Source File: ExprStringCase.java From Skript with GNU General Public License v3.0 | 5 votes |
private static String toPascalCase(String str, boolean strict) { String[] words = str.split(" "); // Splits at spaces String buf = ""; for (int i = 0; i < words.length; i++) buf += strict ? WordUtils.capitalizeFully(words[i]) : WordUtils.capitalize(words[i]); return buf; }
Example 10
Source File: JavaParameterHost.java From das with Apache License 2.0 | 5 votes |
public String getCamelCaseUncapitalizedName() { String temp = name.replace("@", ""); temp = WordUtils.capitalizeFully(temp); if (temp.contains("_")) { temp = WordUtils.capitalizeFully(temp.replace('_', ' ')).replace(" ", ""); } return WordUtils.uncapitalize(temp); }
Example 11
Source File: BeltMetaDataStatisticsViewer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Creates the MD that goes into the clipboard on copy. */ private String createClipboardData() { IOTable tableOrNull = model.getTableOrNull(); if (tableOrNull == null) { return ""; } StringBuilder sb = new StringBuilder(); for (AbstractBeltColumnStatisticsModel statModel : model.getOrderedColumnStatisticsModels()) { // append general stats like name, type, missing values sb.append(statModel.getColumnName()); sb.append("\t"); String valueTypeString = WordUtils.capitalizeFully(tableOrNull.getTable().column(statModel.getColumnName()).type().id().toString()); sb.append(valueTypeString); sb.append("\t"); sb.append(Tools.formatIntegerIfPossible(statModel.getNumberOfMissingValues())); sb.append("\t"); if (BeltNumericalColumnStatisticsModel.class.isAssignableFrom(statModel.getClass())) { sb.append(((BeltNumericalColumnStatisticsModel) statModel).getAverage()); sb.append("\t"); sb.append(((BeltNumericalColumnStatisticsModel) statModel).getDeviation()); sb.append("\t"); sb.append(((BeltNumericalColumnStatisticsModel) statModel).getMinimum()); sb.append("\t"); sb.append(((BeltNumericalColumnStatisticsModel) statModel).getMaximum()); } else if (BeltTimeColumnStatisticsModel.class.isAssignableFrom(statModel.getClass())) { sb.append(Objects.toString(((BeltTimeColumnStatisticsModel) statModel).getAverage(), "?")); sb.append("\t"); sb.append(Objects.toString(((BeltTimeColumnStatisticsModel) statModel).getDeviation(), "?")); sb.append("\t"); sb.append(Objects.toString(((BeltTimeColumnStatisticsModel) statModel).getMinimum(), "?")); sb.append("\t"); sb.append(Objects.toString(((BeltTimeColumnStatisticsModel) statModel).getMaximum(), "?")); } else if (BeltNominalColumnStatisticsModel.class.isAssignableFrom(statModel.getClass())) { int count = 0; List<String> valueStrings = ((BeltNominalColumnStatisticsModel) statModel).getValueStrings(); for (String valueString : valueStrings) { sb.append(valueString); if (count < valueStrings.size() - 1) { sb.append(", "); } count++; } } else if (BeltDateTimeColumnStatisticsModel.class.isAssignableFrom(statModel.getClass())) { sb.append(((BeltDateTimeColumnStatisticsModel) statModel).getDuration()); sb.append("\t"); sb.append(((BeltDateTimeColumnStatisticsModel) statModel).getFrom()); sb.append("\t"); sb.append(((BeltDateTimeColumnStatisticsModel) statModel).getUntil()); } // next row for next column sb.append(System.lineSeparator()); } return sb.toString(); }
Example 12
Source File: Utils.java From NationStatesPlusPlus with MIT License | 4 votes |
public static String formatName(String name) { return WordUtils.capitalizeFully(name.replaceAll("_", " ")); }
Example 13
Source File: TemConstants.java From kfs with GNU Affero General Public License v3.0 | 4 votes |
public String getName() { return WordUtils.capitalizeFully(StringUtils.replace(this.toString(), "_", " ")); }
Example 14
Source File: MetadataUtils.java From smarthome with Eclipse Public License 2.0 | 4 votes |
/** * Returns the label string for the given Datapoint. */ public static String getLabel(HmDatapoint dp) { return WordUtils.capitalizeFully(StringUtils.replace(dp.getName(), "_", " ")); }
Example 15
Source File: AWSDeviceFarmTestResult.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 4 votes |
public String getStatus() { return WordUtils.capitalizeFully(status); }
Example 16
Source File: ScriptsRowModel.java From APM with Apache License 2.0 | 4 votes |
public String label(Object object) { String words = object.toString().replace('_', ' '); words = WordUtils.capitalizeFully(words.toLowerCase()); return words; }
Example 17
Source File: AbstractDatasourceServlet.java From APM with Apache License 2.0 | 4 votes |
private String getName(String item) { String words = item.replace('_', ' '); words = WordUtils.capitalizeFully(words.toLowerCase()); return words; }
Example 18
Source File: CapitalizationAspect.java From openregistry with Apache License 2.0 | 4 votes |
protected String doNormalCaseCapitalization(final String value) { return WordUtils.capitalizeFully(value); }
Example 19
Source File: TagTask.java From StackMob-3 with GNU General Public License v3.0 | 4 votes |
public void run() { MythicMobsHook mobsHook = (MythicMobsHook) sm.getHookManager().getHook(PluginCompat.MYTHICMOBS); for (Entity e : WorldTools.getLoadedEntities()) { if (!sm.getCustomConfig().getStringList("no-stack-worlds").contains(e.getWorld().getName())) { if(!(e instanceof Mob)){ continue; } if (StackTools.hasValidStackData(e)) { String typeString = e.getType().toString(); int stackSize = StackTools.getSize(e); int removeAt = sm.getCustomConfig().getInt("tag.remove-at"); if (sm.getCustomConfig().isString("custom." + typeString + ".tag.remove-at")) { removeAt = sm.getCustomConfig().getInt("custom." + typeString + ".tag.remove-at"); } if (stackSize > removeAt) { String format = sm.getCustomConfig().getString("tag.format"); if (sm.getCustomConfig().isString("custom." + typeString + ".tag.format")) { format = sm.getCustomConfig().getString("custom." + typeString + ".tag.format"); } // Change if it is a mythic mob. if (sm.getHookManager().isHookRegistered(PluginCompat.MYTHICMOBS) && mobsHook.isMythicMob(e)) { typeString = mobsHook.getDisplayName(e); } else if (sm.getCustomConfig().getBoolean("tag.use-translations")) { typeString = "" + sm.getTranslationConfig().getString(e.getType().toString()); } String formattedType = WordUtils.capitalizeFully(typeString.replaceAll("[^A-Za-z0-9]", " ")); String nearlyFinal = StringUtils.replace(StringUtils.replace(StringUtils.replace(format, "%bukkit_type%", e.getType().toString()), "%type%", formattedType), "%size%", String.valueOf(stackSize)); String finalString = ChatColor.translateAlternateColorCodes('&', nearlyFinal); if(!finalString.equals(e.getCustomName())){ e.setCustomName(finalString); } if(!(sm.getHookManager().isHookRegistered(PluginCompat.PROCOTOLLIB))){ boolean alwaysVisible = sm.getCustomConfig().getBoolean("tag.always-visible"); if (sm.getCustomConfig().isString("custom." + typeString + ".tag.always-visible")) { alwaysVisible = sm.getCustomConfig().getBoolean("custom." + typeString + ".tag.always-visible"); } e.setCustomNameVisible(alwaysVisible); } } } } } }
Example 20
Source File: HealthUtil.java From ActionHealth with MIT License | 4 votes |
private String capitalizeFully(String words) { words = words.toLowerCase(); return WordUtils.capitalizeFully(words); }