Example usage for org.apache.commons.lang WordUtils capitalizeFully

List of usage examples for org.apache.commons.lang WordUtils capitalizeFully

Introduction

In this page you can find the example usage for org.apache.commons.lang WordUtils capitalizeFully.

Prototype

public static String capitalizeFully(String str) 

Source Link

Document

Converts all the whitespace separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.

Usage

From source file:com.redsqirl.dynamictable.SelectableTable.java

protected void updateTitles() {
    if (columnIds != null) {
        titles = new LinkedList<String>();
        filters = new LinkedList<String>();
        Iterator<String> columnIdsIt = columnIds.iterator();
        while (columnIdsIt.hasNext()) {
            filters.add("");
            titles.add(WordUtils.capitalizeFully(columnIdsIt.next().replace("_", " ")));
        }/*w w w .  j  av  a2s  . com*/

    }
}

From source file:de.unioninvestment.eai.portal.portlet.crud.scripting.category.StringCategory.java

/**
 * <p>//  w  w  w  .  j  a  v  a 2 s .c o  m
 * Converts all the whitespace separated words in a String into capitalized
 * words, that is each word is made up of a titlecase character and then a
 * series of lowercase characters.
 * </p>
 * <p>
 * For details and examples see {@link WordUtils#capitalizeFully(String)}.
 * </p>
 * 
 * @param s
 *            the String to capitalize, may be null
 * @return capitalized String, <code>null</code> if null String input
 * @since 1.46
 * @author Jan Malcomess (codecentric AG)
 */
public static String capitalizeFully(String s) {
    return WordUtils.capitalizeFully(s);
}

From source file:hu.bme.mit.trainbenchmark.config.TrainBenchmarkConfig.java

public String getScenarioName() {
    return WordUtils.capitalizeFully(scenario.toString());
}

From source file:de.Keyle.MyPet.api.Util.java

public static String capitalizeName(String name) {
    Validate.notNull(name, "Name can't be null");

    name = name.replace("_", " ");
    name = WordUtils.capitalizeFully(name);
    name = name.replace(" ", "");
    return name;//  ww  w  .j a va  2s . c  o m
}

From source file:ddf.catalog.transformer.html.models.HtmlCategoryModel.java

private String getHumanReadableAttribute(String attr) {
    String readableAttr = attr;//ww w  . ja  v a2s  .  c  o  m

    int periodIndex = readableAttr.lastIndexOf('.');
    if (periodIndex != -1) {
        readableAttr = attr.substring(periodIndex + 1);
    }

    readableAttr = readableAttr.replaceAll("-", " ");

    return WordUtils.capitalizeFully(readableAttr);
}

From source file:com.yahoo.flowetl.commons.runner.Main.java

/**
 * Gets some useful runtime info as a map of names -> info.
 *///  w w w .  ja va 2s.c o m
private static Map<String, Object> getRuntimeInfo() {
    Map<String, Object> sysInfo = new TreeMap<String, Object>();
    StringBuilder jvminfo = new StringBuilder();
    jvminfo.append("Vendor: ");
    jvminfo.append(SystemUtils.JAVA_VENDOR);
    jvminfo.append(", Version: ");
    jvminfo.append(SystemUtils.JAVA_VERSION + " - " + SystemUtils.JAVA_VM_INFO);
    jvminfo.append(", OS: ");
    jvminfo.append(SystemUtils.OS_NAME + " (" + SystemUtils.OS_VERSION + " : " + SystemUtils.OS_ARCH + ")");
    sysInfo.put(WordUtils.capitalizeFully("jvm"), jvminfo.toString());
    sysInfo.put(WordUtils.capitalizeFully("default charset encoding"), DEF_CHAR_SET.name());
    String netAdd = NetUtils.getLocalAddress();
    if (StringUtils.isEmpty(netAdd)) {
        netAdd = "????";
    }
    String localName = NetUtils.getLocalHostName();
    if (StringUtils.isEmpty(localName)) {
        localName = "????";
    }
    sysInfo.put(WordUtils.capitalizeFully("network"), localName + " at ip address " + netAdd);
    String cPath = SystemUtils.JAVA_CLASS_PATH;
    String linesep = StringEscapeUtils.escapeJava(SystemUtils.LINE_SEPARATOR);
    sysInfo.put(WordUtils.capitalizeFully("classpath"), cPath);
    sysInfo.put(WordUtils.capitalizeFully("jvm home"), SystemUtils.JAVA_HOME);
    sysInfo.put(WordUtils.capitalizeFully("jvm tmpdir"), SystemUtils.JAVA_IO_TMPDIR);
    sysInfo.put(WordUtils.capitalizeFully("jvm libpath"), SystemUtils.JAVA_LIBRARY_PATH);
    sysInfo.put(WordUtils.capitalizeFully("line separator"), linesep);
    sysInfo.put(WordUtils.capitalizeFully("path separator"),
            StringEscapeUtils.escapeJava(SystemUtils.PATH_SEPARATOR));
    sysInfo.put(WordUtils.capitalizeFully("user timezone"), SystemUtils.USER_TIMEZONE);
    sysInfo.put(WordUtils.capitalizeFully("user home"), SystemUtils.USER_HOME);
    sysInfo.put(WordUtils.capitalizeFully("user language"), SystemUtils.USER_LANGUAGE);
    sysInfo.put(WordUtils.capitalizeFully("user name"), SystemUtils.USER_NAME);
    return sysInfo;
}

From source file:net.lordsofcode.zephyrus.commands.SpellCommands.java

@Command(name = "bind", permission = "zephyrus.bind", description = "Binds a spell to a wand", usage = "/bind (spell)")
public void bindCommand(CommandArgs cmd) {
    if (!cmd.isPlayer()) {
        Lang.errMsg("ingameonly", cmd.getSender());
        return;//from w  w w . j ava  2 s.  co  m
    }
    if (cmd.getArgs().length == 0) {
        Lang.errMsg("bind.nospell", cmd.getSender());
        return;
    }
    if (Zephyrus.getSpellMap().containsKey(cmd.getArgs()[0])) {
        ISpell spell = Zephyrus.getSpellMap().get(cmd.getArgs()[0]);
        Player player = cmd.getPlayer();
        IUser user = Zephyrus.getUser(player);
        ItemStack item = player.getItemInHand();
        if (user.isLearned(spell) || user.hasPermission(spell)) {
            if (Zephyrus.getItemManager().isWand(item)) {
                ICustomItemWand wand = Zephyrus.getItemManager().getWand(item);
                if (wand.getCanBind(spell)) {
                    if (spell.canBind()) {
                        ItemMeta m = item.getItemMeta();
                        m.setDisplayName(wand.getBoundName(spell));
                        m.setLore(wand.getBoundLore(spell));
                        item.setItemMeta(m);
                        player.sendMessage(ChatColor.GRAY + Lang.get("bind.finish").replace("[SPELL]", WordUtils
                                .capitalizeFully(ChatColor.GOLD + spell.getDisplayName() + ChatColor.GRAY)));
                    } else {
                        cmd.getSender().sendMessage(
                                ChatColor.DARK_RED + Lang.get("bind.cantbind").replace("[SPELL]", ChatColor.GOLD
                                        + WordUtils.capitalizeFully(spell.getDisplayName()) + ChatColor.RED));
                    }
                } else {
                    Lang.errMsg("bind.cantbindwand", player);
                }
            } else {
                Lang.errMsg("bind.needwand", player);
            }
        } else {
            Lang.errMsg("notlearned", cmd.getSender());
        }

    } else {
        Lang.errMsg("notlearned", cmd.getSender());
    }
}

From source file:fr.cph.stock.external.YahooExternalDataAccess.java

@Override
public final List<Company> getCompaniesData(final List<String> yahooIds) throws YahooException {
    List<Company> companies = new ArrayList<Company>();

    String requestQuotes = "select * from yahoo.finance.quotes where symbol in (" + getFormattedList(yahooIds)
            + ")";
    Yahoo yahoo = new Yahoo(requestQuotes);
    JSONObject json = yahoo.getJSONObject();
    JSONArray jsonResults = getJSONArrayFromJSONObject(json);
    for (int j = 0; j < jsonResults.size(); j++) {
        JSONObject jsonCompany = jsonResults.getJSONObject(j);
        Company company = new Company();
        company.setYahooId(jsonCompany.optString("symbol"));
        company.setManual(false);//w ww  . ja v a  2 s.  c o  m
        if (jsonCompany.optString("StockExchange").equals("null")) {
            company = getCompanyInfo(company);
            if (company.getSector() != null && company.getIndustry() != null
                    && company.getMarketCapitalization() != null) {
                company.setRealTime(false);
                company.setMarket(guessMarket(company.getYahooId()));
                company.setCurrency(Market.getCurrency(company.getMarket()));
                Calendar cal = Calendar.getInstance();
                cal.add(Calendar.DATE, -5);
                try {
                    List<Company> temp = getCompanyDataHistory(company.getYahooId(), cal.getTime(), null);
                    company.setQuote(temp.get(0).getQuote());
                } catch (YahooException e) {
                    LOG.info(e.getMessage(), e);
                }
                companies.add(company);
            } else {
                throw new YahooUnknownTickerException(
                        jsonCompany.optString("symbol") + YahooUnknownTickerException.TOCKEN_UNKNOWN);
            }
        } else {
            company.setName(WordUtils.capitalizeFully(jsonCompany.optString("Name")));
            company.setMarket(Market.getMarket(jsonCompany.optString("StockExchange").toUpperCase()));

            company.setCurrency(Market.getCurrency(company.getMarket()));
            if (!jsonCompany.optString("DividendYield").equals("null")) {
                company.setYield(Double.valueOf(jsonCompany.optString("DividendYield")));
            }
            company.setQuote(Double.valueOf(jsonCompany.optString("LastTradePriceOnly")));
            String marketCap = jsonCompany.optString("MarketCapitalization");
            if (marketCap != null && !marketCap.equals("null") && !marketCap.equals("")) {
                company.setMarketCapitalization(marketCap);
            }
            Double previousClose = jsonCompany.optDouble("PreviousClose");
            if (previousClose != null && !previousClose.isNaN()) {
                company.setYesterdayClose(previousClose);
            } else {
                company.setYesterdayClose(0.0);
            }
            company.setChangeInPercent(jsonCompany.optString("ChangeinPercent"));
            Double yearLow = jsonCompany.optDouble("YearLow");
            if (!yearLow.isNaN()) {
                company.setYearLow(yearLow);
            }
            Double yearHigh = jsonCompany.optDouble("YearHigh");
            if (!yearHigh.isNaN()) {
                company.setYearHigh(yearHigh);
            }
            company.setRealTime(true);
            company.setFund(false);
            companies.add(company);
        }
    }
    return companies;
}

From source file:net.sf.click.jquery.examples.util.StartupListener.java

private void loadPostCodes() throws IOException {
    loadFile("post-codes-australian.csv", new LineProcessor() {
        public void processLine(String line) {
            if (!line.startsWith("Pcode")) {
                StringTokenizer tokenizer = new StringTokenizer(line, ",");

                String postcode = next(tokenizer);
                String locality = WordUtils.capitalizeFully(next(tokenizer));
                String state = next(tokenizer);

                PostCode postCode = new PostCode();
                postCode.setPostCode(postcode);
                postCode.setLocality(locality);
                postCode.setState(state);

                POST_CODES.add(postCode);
            }//from  w ww . java  2 s. c  o  m
        }
    });
}

From source file:com.turqmelon.MelonDamageLib.listeners.DamageListener.java

@EventHandler(priority = EventPriority.MONITOR)
public void onDamage(EntityDamageEvent event) {

    Entity entity = event.getEntity();
    if (!(entity instanceof LivingEntity)) {
        return;/*from   w w w .j  ava2  s .com*/
    }

    DamageTick item = null;
    double dmg = event.getDamage(EntityDamageEvent.DamageModifier.BASE);

    if (event.isCancelled() || dmg == 0)
        return;

    if ((event instanceof EntityDamageByEntityEvent)) {
        EntityDamageByEntityEvent evt = (EntityDamageByEntityEvent) event;

        Entity damager = evt.getDamager();

        LivingEntity attacker = null;
        double distance = 0;

        if ((damager instanceof LivingEntity)) {
            attacker = (LivingEntity) damager;
        } else if ((damager instanceof Projectile)) {
            Projectile projectile = (Projectile) damager;
            if ((projectile.getShooter() instanceof LivingEntity)) {
                attacker = (LivingEntity) projectile.getShooter();
                distance = attacker.getLocation().distance(entity.getLocation());
            }

        } else if ((damager instanceof TNTPrimed)) {
            if (((TNTPrimed) damager).getSource() != null) {
                item = new TNTDamageTick(dmg, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, "TNT",
                        System.currentTimeMillis(), damager.getLocation(),
                        (Player) ((TNTPrimed) damager).getSource());
            } else
                item = new BlockDamageTick(dmg, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, "TNT",
                        System.currentTimeMillis(), Material.TNT, damager.getLocation());
        }

        if (attacker != null) {
            if ((attacker instanceof Player)) {
                if (distance > 0) {
                    item = new PlayerDamageTick(dmg, "PVP", System.currentTimeMillis(), (Player) attacker,
                            distance);
                } else {
                    item = new PlayerDamageTick(dmg, "PVP", System.currentTimeMillis(), (Player) attacker);
                }
            } else {
                if (distance > 0) {
                    item = new MonsterDamageTick(dmg, "PVE", System.currentTimeMillis(), attacker, distance);
                } else {
                    item = new MonsterDamageTick(dmg, "PVE", System.currentTimeMillis(), attacker);
                }
            }
        }

    } else if ((event instanceof EntityDamageByBlockEvent)) {
        EntityDamageByBlockEvent evt = (EntityDamageByBlockEvent) event;
        item = new BlockDamageTick(dmg, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, "BLOCK",
                System.currentTimeMillis(), evt.getDamager().getType(), evt.getDamager().getLocation());
    } else {

        if (event.getCause() == EntityDamageEvent.DamageCause.FALL) {
            item = new FallDamageTick(dmg, "Fall", System.currentTimeMillis(), entity.getFallDistance());
        } else {
            String name = event.getCause().name();
            name = WordUtils.capitalizeFully(name).replace("_", " ");

            item = new OtherDamageTick(dmg, event.getCause(), name, System.currentTimeMillis());
        }

    }

    if (item != null) {
        DamageManager.logTick(entity.getUniqueId(), item);
    }
}