Java 类org.apache.commons.lang.WordUtils 实例源码

项目:hadoop-oss    文件:TableListing.java   
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
项目:hadoop    文件:TableListing.java   
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
项目:rapidminer    文件:ActivationSuccessfulCard.java   
private void fillContent(String owner, String edition, String expires, String additionalInformation) {
    if(owner != null) {
        this.lbRegisteredToResult.setText(owner);
    } else {
        this.lbRegisteredToResult.setText("-");
    }

    if(edition != null) {
        this.lbStatus.setText(WordUtils.capitalize(edition) + " " + LICENSE_INSTALLED);
    } else {
        this.lbStatus.setText("- " + LICENSE_INSTALLED);
    }

    if(expires != null) {
        this.lbExpiresResult.setText(expires);
    } else {
        this.lbExpiresResult.setText("-");
    }

    if(additionalInformation != null && additionalInformation.trim().isEmpty()) {
        this.lbAdditionalInfo.setText((String)null);
    } else {
        this.lbAdditionalInfo.setText(additionalInformation);
    }

}
项目:ProjectAres    文件:KDMListener.java   
@EventHandler(priority = EventPriority.LOW)
public void onMatchEnd(MatchEndEvent event) {
    Match match = event.getMatch();
    Tourney plugin = Tourney.get();
    this.session.appendMatch(match, plugin.getMatchManager().getTeamManager().teamToEntrant(Iterables.getOnlyElement(event.getMatch().needMatchModule(VictoryMatchModule.class).winners(), null)));

    Entrant winningParticipation = this.session.calculateWinner();
    int matchesPlayed = this.session.getMatchesPlayed();
    if (winningParticipation != null) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has been determined!");
        Bukkit.broadcastMessage(ChatColor.AQUA + WordUtils.capitalize(winningParticipation.team().name()) + ChatColor.RESET + ChatColor.YELLOW + " wins! Congratulations!");
        plugin.clearKDMSession();
    } else if (matchesPlayed < 3) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has not yet been determined! Beginning match #" + (matchesPlayed + 1) + "...");
        match.needMatchModule(CycleMatchModule.class).startCountdown(Duration.ofSeconds(15), session.getMap());
    } else {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "There is a tie! Congratulations to both teams!");
        Tourney.get().clearKDMSession();
    }
}
项目:magento2-phpstorm-plugin    文件:PluginLineMarkerProvider.java   
@Override
public List<Method> collect(@NotNull Method psiElement) {
    List<Method> results = new ArrayList<>();

    PhpClass methodClass = psiElement.getContainingClass();
    if (methodClass == null) {
        return results;
    }

    List<PhpClass> pluginsList = pluginClassCache.getPluginsForClass(methodClass);
    List<Method> pluginMethods = pluginClassCache.getPluginMethods(pluginsList);

    String classMethodName = WordUtils.capitalize(psiElement.getName());
    for (Method pluginMethod: pluginMethods) {
        if (isPluginMethodName(pluginMethod.getName(), classMethodName)) {
            results.add(pluginMethod);
        }
    }
    return results;
}
项目:mxisd    文件:EmailConfig.java   
@PostConstruct
public void build() {
    log.info("--- E-mail config ---");

    if (StringUtils.isBlank(getGenerator())) {
        throw new ConfigurationException("generator");
    }

    if (StringUtils.isBlank(getConnector())) {
        throw new ConfigurationException("connector");
    }

    log.info("From: {}", identity.getFrom());

    if (StringUtils.isBlank(identity.getName())) {
        identity.setName(WordUtils.capitalize(mxCfg.getDomain()) + " Identity Server");
    }
    log.info("Name: {}", identity.getName());
    log.info("Generator: {}", getGenerator());
    log.info("Connector: {}", getConnector());
}
项目:hadoop    文件:CacheAdmin.java   
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      AdminHelper.MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
项目:PA    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(AsyncPlayerChatEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());

    //AdminChat
    if (PAServer.getAdminChatMode().contains(u)) {
        Utils.sendAdminMsg(u.getName(), e.getMessage());
        e.setCancelled(true);
    }

    //Format
    String name = u.getDisplayName().equalsIgnoreCase("") ? u.getName() : u.getDisplayName();
    String tag = "[&" + PACmd.Grupo.groupColor(u.getUserData().getGrupo()) + WordUtils.capitalizeFully(u.getUserData().getGrupo().toString().toLowerCase()) + "&r] &" + PACmd.Grupo.groupColor(u.getUserData().getGrupo()) + name + "&r: ";
    if (u.isOnRank(PACmd.Grupo.ORIGIN)) e.setMessage(Utils.colorize(e.getMessage()));

    e.setFormat(Utils.colorize(tag) + e.getMessage().replace("%", ""));
}
项目:AsgardAscension    文件:MainInventory.java   
public static void setupRankUpMenu(Player player) {
    Inventory inv = Bukkit.createInventory(player, 9, ChatColor.BOLD + "Rank-Up");
    int challenge = plugin.getPlayerManager().getRank(player) + 1;
    inv.setItem(2, ItemStackGenerator.createItem(Material.DIAMOND_HELMET, 0, 0, 
            ChatColor.LIGHT_PURPLE + "I trust my strength!",
            Arrays.asList(  ChatColor.RED   + "Earn rankup by completing the challenge",
                            ChatColor.RED   + "for lesser amount of money!"), true));
    inv.setItem(4, ItemStackGenerator.createItem(Material.BOOK, 0, 0, 
            ChatColor.LIGHT_PURPLE + "RankUp Information",
            Arrays.asList(  ChatColor.RED + "Next rank: " + plugin.getChallengesFile().getTitle(challenge),
                            ChatColor.RED + "Challenge type: " + WordUtils.capitalize(plugin.getChallengesFile().getType(challenge)),
                            ChatColor.RED + "Price: " + Convert.toPrice(plugin.getChallengesFile().getPrice(challenge) * (plugin.getPlayerManager().getPrestige(player) + 1), true))));
    inv.setItem(6, ItemStackGenerator.createItem(Material.GOLD_INGOT, 0, 0, 
            ChatColor.LIGHT_PURPLE + "I can buy anything!",
            Arrays.asList(  ChatColor.RED   + "Skip the challenge by",
                            ChatColor.RED + "paying 2 times more!")));
    player.openInventory(inv);
}
项目:Word2VecfJava    文件:ContextInstance.java   
public ContextInstance(String line, boolean noPosFlag) {
    this.line = line;
    String[] tokens = line.split("\t");
    this.targetInd = Integer.parseInt(tokens[TARGET_INDEX]);
    this.words = tokens[3].split(" ");
    this.target = this.words[this.targetInd];
    this.fullTargetKey = tokens[0];
    this.pos = this.fullTargetKey.split(".")[this.fullTargetKey.split(".").length - 1];
    String[] tmp = this.fullTargetKey.split(".");
    this.targetKey = String.join(".", Arrays.asList(tmp[0], tmp[1])); // remove suffix in cases of bar.n.v
    this.targetLemma = this.fullTargetKey.split(".")[0];
    this.targetId = Integer.parseInt(tokens[1]);
    if (validPOS.contains(this.pos)) this.pos = WordUtils.capitalize(this.pos);
    if (noPosFlag) this.targetPos = String.join(".", Arrays.asList(this.target, "*"));
    else this.targetPos = String.join(".", Arrays.asList(this.target, this.pos));
}
项目:aliyun-oss-hadoop-fs    文件:CacheAdmin.java   
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      AdminHelper.MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
项目:aliyun-oss-hadoop-fs    文件:TableListing.java   
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
项目:bioasq    文件:GoPubMedTripleRetrievalExecutor.java   
private void addQueryWord(String s){
    if(s==null)return;
    if(s.length()==0)return;
    if(queryWords.contains(s))
        return;
    else
        queryWords.add(s);

    if(sb.length()>0) sb.append(" OR ");
    sb.append(s+"[obj] OR "+ s + "[subj]");
    List<String> ls = new LinkedList<String>();
    ls.add(s.toUpperCase());
    ls.add(s.toLowerCase());
    ls.add(WordUtils.capitalize(s));
    for(String x:ls){
        sb.append(" OR ");
        sb.append(x);
        sb.append("[obj] OR ");
        sb.append(x);
        sb.append("[subj]");
    }
}
项目:NametagEdit    文件:Converter.java   
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);
    }
}
项目:OSCAR-ConCert    文件:SpringUtils.java   
/**
 * Attempts to find a Spring bean based of the specified class. This method first attempts to load a bean
 * following the default Spring auto-naming conventions (de-capitalizing class simple name). In case the bean with 
 * this name can't be found, the method returns the first available bean of this class.
 * <p/>
 * Such logic is required in order to enable this method to lookup components from legacy contexts. "Older" beans seems to 
 * have identifiers hard-coded in the bean definition file, while "newer" bean identifiers are auto-generated by Spring based on the
 * annotations.
 * 
 * @param clazz
 *      Class of the bean to be looked up
 * @return
 *      Returns the bean instance
 * @throws NoSuchBeanDefinitionException if there is no bean definition with the specified name
 */
@SuppressWarnings("unchecked")
public static <T> T getBean(Class<?> clazz) {
    // legacy code - I wonder if it's necessary since we are looking up a bean based directly on the class name anyways
    // but to keep legacy logic working properly attempt to locate component based on the Spring conventions 
    String className = WordUtils.uncapitalize(clazz.getSimpleName());
    if (beanFactory.containsBean(className))
        return (T) beanFactory.getBean(className);

    if (ListableBeanFactory.class.isAssignableFrom(beanFactory.getClass())) {
        ListableBeanFactory listableBeanFactory = (ListableBeanFactory) beanFactory;
        String[] beanNames = listableBeanFactory.getBeanNamesForType(clazz);
        if (beanNames.length > 0)
            return (T) listableBeanFactory.getBean(beanNames[0]);
    }
    throw new NoSuchBeanDefinitionException(clazz);
}
项目:OSCAR-ConCert    文件:CodeSearchService.java   
@Override
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<LabelValueBean> results = new ArrayList<LabelValueBean>();
String codingSystem = request.getParameter("codingSystem");

AbstractCodeSystemDao dao = (AbstractCodeSystemDao)SpringUtils.getBean(WordUtils.uncapitalize(codingSystem) + "Dao");

if(request.getParameter("term") != null && request.getParameter("term").length() > 0) {
    List<AbstractCodeSystemModel> r = dao.searchCode(request.getParameter("term"));
    for(AbstractCodeSystemModel result:r) {
        results.add(new LabelValueBean(result.getDescription(),result.getCode()));
    }
}
response.setContentType("text/x-json");
      JSONArray jsonArray = JSONArray.fromObject( results );
      jsonArray.write(response.getWriter());

   return null;
  }
项目:big-c    文件:CacheAdmin.java   
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      AdminHelper.MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
项目:big-c    文件:TableListing.java   
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
项目:hive-phoenix-handler    文件:Utilities.java   
/**
 * convert "From src insert blah blah" to "From src insert ... blah"
 */
public static String abbreviate(String str, int max) {
  str = str.trim();

  int len = str.length();
  int suffixlength = 20;

  if (len <= max) {
    return str;
  }

  suffixlength = Math.min(suffixlength, (max - 3) / 2);
  String rev = StringUtils.reverse(str);

  // get the last few words
  String suffix = WordUtils.abbreviate(rev, 0, suffixlength, "");
  suffix = StringUtils.reverse(suffix);

  // first few ..
  String prefix = StringUtils.abbreviate(str, max - suffix.length());

  return prefix + suffix;
}
项目:dal    文件:AbstractJavaDataPreparer.java   
protected String getPojoClassName(String prefix, String suffix, String tableName) {
    String className = tableName;
    if (null != prefix && !prefix.isEmpty() && className.indexOf(prefix) == 0) {
        className = className.replaceFirst(prefix, "");
    }
    if (null != suffix && !suffix.isEmpty()) {
        className = className + WordUtils.capitalize(suffix);
    }

    StringBuilder result = new StringBuilder();
    for (String str : StringUtils.split(className, "_")) {
        result.append(WordUtils.capitalize(str));
    }

    return WordUtils.capitalize(result.toString());
}
项目:dal    文件:AbstractCSharpDataPreparer.java   
protected String getPojoClassName(String prefix, String suffix, String table) {
    String className = table;
    if (null != prefix && !prefix.isEmpty() && className.indexOf(prefix) == 0) {
        className = className.replaceFirst(prefix, "");
    }
    if (null != suffix && !suffix.isEmpty()) {
        className = className + WordUtils.capitalize(suffix);
    }

    StringBuilder result = new StringBuilder();
    for (String str : StringUtils.split(className, "_")) {
        result.append(WordUtils.capitalize(str));
    }

    return WordUtils.capitalize(result.toString());
}
项目:dal    文件:CSharpDataPreparerOfFreeSqlProcessor.java   
private void prepareDbFromFreeSql(CodeGenContext codeGenCtx, List<GenTaskByFreeSql> freeSqls) throws Exception {
    CSharpCodeGenContext ctx = (CSharpCodeGenContext) codeGenCtx;
    Map<String, DatabaseHost> _dbHosts = ctx.getDbHosts();
    Set<String> _freeDaos = ctx.getFreeDaos();
    for (GenTaskByFreeSql task : freeSqls) {
        addDatabaseSet(ctx, task.getDatabaseSetName());
        _freeDaos.add(WordUtils.capitalize(task.getClass_name()));
        if (!_dbHosts.containsKey(task.getAllInOneName())) {
            String provider = "sqlProvider";
            String dbType = DbUtils.getDbType(task.getAllInOneName());
            if (null != dbType && !dbType.equalsIgnoreCase("Microsoft SQL Server")) {
                provider = "mySqlProvider";
            }
            DatabaseHost host = new DatabaseHost();
            host.setAllInOneName(task.getAllInOneName());
            host.setProviderType(provider);
            host.setDatasetName(task.getDatabaseSetName());
            _dbHosts.put(task.getAllInOneName(), host);
        }
    }
}
项目:dal    文件:CSharpMethodHost.java   
public String getParameterDeclaration() {
    List<String> paramsDeclaration = new ArrayList<>();
    for (CSharpParameterHost parameter : parameters) {
        ConditionType conditionType = parameter.getConditionType();
        if (conditionType == ConditionType.In || parameter.isInParameter()) {
            paramsDeclaration.add(String.format("List<%s> %s", parameter.getType(), WordUtils.uncapitalize(parameter.getAlias())));
        } else if (conditionType == ConditionType.IsNull || conditionType == ConditionType.IsNotNull
                || conditionType == ConditionType.And || conditionType == ConditionType.Or
                || conditionType == ConditionType.Not || conditionType == ConditionType.LeftBracket
                || conditionType == ConditionType.RightBracket) {
            continue;// is null、is not null don't hava param
        } else {
            paramsDeclaration.add(String.format("%s %s", parameter.getType(), WordUtils.uncapitalize(parameter.getAlias())));
        }
    }
    if (this.paging && this.crud_type.equalsIgnoreCase("select")) {
        paramsDeclaration.add("int pageNo");
        paramsDeclaration.add("int pageSize");
    }
    return StringUtils.join(paramsDeclaration, ", ");
}
项目:SonarPet    文件:PetOwnerListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
    final Player p = event.getPlayer();
    final IPet pi = EchoPet.getManager().getPet(p);
    Iterator<IPet> i = EchoPet.getManager().getPets().iterator();
    while (i.hasNext()) {
        IPet pet = i.next();
        if (pet.getEntityPet() instanceof IEntityPacketPet && ((IEntityPacketPet) pet.getEntityPet()).hasInititiated()) {
            if (GeometryUtil.getNearbyEntities(event.getTo(), 50).contains(pet)) {
                ((IEntityPacketPet) pet.getEntityPet()).updatePosition();
            }
        }
    }
    if (pi != null) {
        if (!WorldUtil.allowPets(event.getTo())) {
            Lang.sendTo(p, Lang.PETS_DISABLED_HERE.toString().replace("%world%", WordUtils.capitalizeFully(event.getTo().getWorld().getName())));
            EchoPet.getManager().saveFileData("autosave", pi);
            EchoPet.getSqlManager().saveToDatabase(pi, false);
            EchoPet.getManager().removePet(pi, false);
        }
    }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:CacheAdmin.java   
@Override
public String getLongUsage() {
  TableListing listing = getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TableListing.java   
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
项目:magento2plugin    文件:PluginLineMarkerProvider.java   
@Override
public List<Method> collect(@NotNull Method psiElement) {
    List<Method> results = new ArrayList<>();

    PhpClass methodClass = psiElement.getContainingClass();
    if (methodClass == null) {
        return results;
    }

    List<PhpClass> pluginsList = pluginClassCache.getPluginsForClass(methodClass);
    List<Method> pluginMethods = pluginClassCache.getPluginMethods(pluginsList);

    String classMethodName = WordUtils.capitalize(psiElement.getName());
    for (Method pluginMethod: pluginMethods) {
        if (isPluginMethodName(pluginMethod.getName(), classMethodName)) {
            results.add(pluginMethod);
        }
    }
    return results;
}
项目:Tank    文件:ExceptionHandler.java   
public void handle(Throwable t) {
    Throwable root = getRoot(t);
    if (root instanceof ConstraintViolationException) {
        ConstraintViolationException c = (ConstraintViolationException) root;
        for (@SuppressWarnings("rawtypes") ConstraintViolation v : c.getConstraintViolations()) {
            StringBuilder sb = new StringBuilder();
            sb.append(WordUtils.capitalize(v.getPropertyPath().iterator().next().getName()));
            sb.append(' ').append(v.getMessage()).append('.');
            messages.error(sb.toString());
        }
    } else if (!StringUtils.isEmpty(root.getMessage())) {
        messages.error(root.getMessage());
    } else {
        messages.error(root.toString());
    }
}
项目:bts    文件:BTSCommentAnnotation.java   
@Override
public String getText() {
    if (comment != null)
    {
        String text = "";
        if (comment.getName() != null)
        {
            text=  comment.getName() + "\n";
        }
        if (comment.getComment() != null && !"".equals(comment.getComment()))
        {
            text += WordUtils.wrap(comment.getComment(), 60);
        }
        return text;
    }
    return super.getText();
}
项目:bts    文件:RelatedObjectGroupComment.java   
@Override
protected void fillContentComposite(Composite composite) {
    if (!getObject().getRevisions().isEmpty())
    {
        BTSRevision rev = getObject().getRevision(0);
        setGroupTitle(userController.getUserDisplayName(rev
                .getUserId()));
    }
    commentText = new Text(composite, SWT.WRAP | SWT.READ_ONLY | SWT.MULTI);
    commentText.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
            true, true, 1, 1));
    BTSObject o = getObject();
    if (o instanceof BTSComment)
    {
        refreshContent((BTSComment) getObject());
    }
    commentText.setToolTipText( WordUtils.wrap(((BTSComment) getObject()).getComment(), 60));
    setExpandBarIcon(resourceProvider.getImage(Display.getCurrent(), BTSResourceProvider.IMG_COMMENT));
    setExpandBarBackground(BTSUIConstants.COLOR_WIHTE);
}
项目:openmrs-module-legacyui    文件:FormatTag.java   
/**
 * Apply a case conversion to an input string
 * @param source
 * @return
 */
private String applyConversion(String source) {

    String result = source;

    // Find global property 
    if ("global".equalsIgnoreCase(caseConversion)) {
        AdministrationService adminService = Context.getAdministrationService();
        caseConversion = adminService.getGlobalProperty(OpenmrsConstants.GP_DASHBOARD_METADATA_CASE_CONVERSION);
    }

    // Apply conversion
    if ("lowercase".equalsIgnoreCase(caseConversion)) {
        result = StringUtils.lowerCase(result);
    } else if ("uppercase".equalsIgnoreCase(caseConversion)) {
        result = StringUtils.upperCase(result);
    } else if ("capitalize".equalsIgnoreCase(caseConversion)) {
        result = WordUtils.capitalize(StringUtils.lowerCase(result));
    }
    return result;
}
项目:Zephyr    文件:SpellTome.java   
public static ItemStack getSpellTome(Spell spell, User user) {
    ItemStack stack = new ItemStack(Material.WRITTEN_BOOK);
    BookMeta meta = (BookMeta) stack.getItemMeta();

    StringBuilder page = new StringBuilder();

    page.append("Spell: " + spell.getName() + "\n");
    page.append(spell.getDescription() + "\n");
    page.append("Mana Cost: " + spell.getManaCost());
    page.append("\n\n");
    page.append("Cast this spell with /cast " + WordUtils.capitalize(spell.getName()) + "\n\n");
    page.append("Learn this spell by left clicking the book");

    meta.setPages(page.toString());
    meta.setAuthor(user.<Player> getPlayer().getName());
    meta.setDisplayName(ChatColor.GOLD + "Spell Tome" + ChatColor.GRAY + SEPERATOR
            + WordUtils.capitalize(spell.getName()));
    meta.setLore(Lists.newArrayList(ChatColor.GRAY + "Learn by left clicking"));
    stack.setItemMeta(meta);
    return stack;
}
项目:powop    文件:FormHelper.java   
public CharSequence radioGroup(Object obj, String field, String values, Options options) {
    StringBuilder radios = new StringBuilder();
    String labelClass = options.hash("labelClass");

    String tmpl = "<label class=\"%s\"><input type=\"radio\" name=\"%s\" value=\"%s\"%s>%s</label>";

    for(String value : values.split(",")) {
        try {
            String checked = "";
            if(BeanUtils.getSimpleProperty(obj, field).equalsIgnoreCase(value)) {
                checked = " checked";
            }
            radios.append(String.format(tmpl, labelClass, field, value, checked, WordUtils.capitalize(value)));
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            log.warn("Could not find property {} on object {}", field, obj);
        }
    }

    return new Handlebars.SafeString(radios);
}
项目:openhab-hdl    文件:WeatherPublisher.java   
/**
 * 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());
    }
}
项目:raptor-chess-interface    文件:ConnectorMessageBlockPage.java   
@Override
protected void createFieldEditors() {
    Label textLabel = new Label(getFieldEditorParent(), SWT.WRAP);
    textLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false, 2, 1));
    textLabel
            .setText(WordUtils
                    .wrap( local.getString("messBlockLbl"),
                            70)
                    + local.getString("regexPathDesc"));

    Label label = new Label(getFieldEditorParent(), SWT.NONE);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false,
            2, 1));

    addField(new ListFieldEditor(connectorShortName + "-"
            + PreferenceKeys.REGULAR_EXPRESSIONS_TO_BLOCK,
            local.getString("regexMatchMess"),
            getFieldEditorParent(), ',', 300));
}
项目:raptor-chess-interface    文件:SpeechPage.java   
@Override
protected void createFieldEditors() {
    LabelFieldEditor userHomeDir = new LabelFieldEditor(
            "NONE",
            WordUtils
                    .wrap(local.getString("speechAns"), 70), 
                    getFieldEditorParent());
    addField(userHomeDir);

    final StringFieldEditor speechProcessName = new StringFieldEditor(
            PreferenceKeys.SPEECH_PROCESS_NAME, local.getString("speechPrcN"),
            getFieldEditorParent());
    addField(speechProcessName);

    labelButtonFieldEditor = new LabelButtonFieldEditor(
            "NONE",
            local.getString("testSet"),
            getFieldEditorParent(), local.getString("test"), new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    SoundService.getInstance().textToSpeech(
                            local.getString("speechStpCrct"));
                }
            });
    addField(labelButtonFieldEditor);
}
项目:raptor-chess-interface    文件:SoundPage.java   
@Override
protected void createFieldEditors() {
    LabelFieldEditor userHomeDir = new LabelFieldEditor(
            "NONE",
            WordUtils
                    .wrap(local.getString("soundP1"),
                            70), getFieldEditorParent());
    addField(userHomeDir);

    final StringFieldEditor soundProcessName = new StringFieldEditor(
            PreferenceKeys.SOUND_PROCESS_NAME, local.getString("soundP2"),
            getFieldEditorParent());
    addField(soundProcessName);

    labelButtonFieldEditor = new LabelButtonFieldEditor(
            "NONE",
            local.getString("soundP3"),
            getFieldEditorParent(), local.getString("test"), new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    SoundService.getInstance().initSoundPlayer();
                    SoundService.getInstance().playSound("win");
                }
            });
    addField(labelButtonFieldEditor);
}
项目:FlexMap    文件:CacheAdmin.java   
@Override
public String getLongUsage() {
  TableListing listing = getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
项目:google-cloud-intellij    文件:IntegratedIntellijGoogleLoginService.java   
@Override
public boolean askYesOrNo(String title, String message) {
  StringBuilder updatedMessageBuilder = new StringBuilder(message);
  if (message.equals(AccountMessageBundle.message("login.service.are.you.sure.key.text"))) {
    updatedMessageBuilder.append(
        AccountMessageBundle.message("login.service.are.you.sure.append.text"));
    for (GoogleLoginMessageExtender messageExtender : messageExtenders) {
      String additionalLogoutMessage = messageExtender.additionalLogoutMessage();
      if (!Strings.isNullOrEmpty(additionalLogoutMessage)) {
        updatedMessageBuilder.append(" ").append(additionalLogoutMessage);
      }
    }
  }
  String updatedMessage =
      WordUtils.wrap(
          updatedMessageBuilder.toString(),
          WRAP_LENGTH,
          /* newLinestr */ null,
          /* wrapLongWords */ false);
  return (Messages.showYesNoDialog(updatedMessage, title, GoogleLoginIcons.GOOGLE_FAVICON)
      == Messages.YES);
}
项目:tellervo    文件:RediscoveryExportEx.java   
/**
 * Extract the county from the Origin field
 * 
 * @return
 */
public String getCounty()
{
    String origin = this.getOrigin();
    String[] parts = origin.split("__");
    if(parts.length==4)
    {

         String county = parts[1].trim();
         return WordUtils.capitalize(county.toLowerCase().replace("--", " - "));    

    }

    log.error("Unable to extract County information from origin field from '"+this.getCatalogCode()+"'");

    return null;

}