Java Code Examples for org.apache.commons.lang.StringUtils.uncapitalize()

The following are Jave code examples for showing how to use uncapitalize() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: hadoop-oss   File: MutableStat.java   View Source Code Vote up 6 votes
/**
 * Construct a sample statistics metric
 * @param name        of the metric
 * @param description of the metric
 * @param sampleName  of the metric (e.g. "Ops")
 * @param valueName   of the metric (e.g. "Time", "Latency")
 * @param extended    create extended stats (stdev, min/max etc.) by default.
 */
public MutableStat(String name, String description,
                   String sampleName, String valueName, boolean extended) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);
  numInfo = info(ucName +"Num"+ usName, "Number of "+ lsName +" for "+ desc);
  iNumInfo = info(ucName +"INum"+ usName,
                  "Interval number of "+ lsName +" for "+ desc);
  avgInfo = info(ucName +"Avg"+ uvName, "Average "+ lvName +" for "+ desc);
  stdevInfo = info(ucName +"Stdev"+ uvName,
                   "Standard deviation of "+ lvName +" for "+ desc);
  iMinInfo = info(ucName +"IMin"+ uvName,
                  "Interval min "+ lvName +" for "+ desc);
  iMaxInfo = info(ucName + "IMax"+ uvName,
                  "Interval max "+ lvName +" for "+ desc);
  minInfo = info(ucName +"Min"+ uvName, "Min "+ lvName +" for "+ desc);
  maxInfo = info(ucName +"Max"+ uvName, "Max "+ lvName +" for "+ desc);
  this.extended = extended;
}
 
Example 2
Project: hadoop   File: MutableStat.java   View Source Code Vote up 6 votes
/**
 * Construct a sample statistics metric
 * @param name        of the metric
 * @param description of the metric
 * @param sampleName  of the metric (e.g. "Ops")
 * @param valueName   of the metric (e.g. "Time", "Latency")
 * @param extended    create extended stats (stdev, min/max etc.) by default.
 */
public MutableStat(String name, String description,
                   String sampleName, String valueName, boolean extended) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);
  numInfo = info(ucName +"Num"+ usName, "Number of "+ lsName +" for "+ desc);
  avgInfo = info(ucName +"Avg"+ uvName, "Average "+ lvName +" for "+ desc);
  stdevInfo = info(ucName +"Stdev"+ uvName,
                   "Standard deviation of "+ lvName +" for "+ desc);
  iMinInfo = info(ucName +"IMin"+ uvName,
                  "Interval min "+ lvName +" for "+ desc);
  iMaxInfo = info(ucName + "IMax"+ uvName,
                  "Interval max "+ lvName +" for "+ desc);
  minInfo = info(ucName +"Min"+ uvName, "Min "+ lvName +" for "+ desc);
  maxInfo = info(ucName +"Max"+ uvName, "Max "+ lvName +" for "+ desc);
  this.extended = extended;
}
 
Example 3
Project: Reer   File: BuildConfigurationRule.java   View Source Code Vote up 5 votes
public void apply(String taskName) {
    if (taskName.startsWith(PREFIX)) {
        String configurationName = StringUtils.uncapitalize(taskName.substring(PREFIX.length()));
        Configuration configuration = configurations.findByName(configurationName);

        if (configuration != null) {
            Task task = tasks.create(taskName);
            task.dependsOn(configuration.getAllArtifacts());
            task.setDescription("Builds the artifacts belonging to " + configuration + ".");
        }
    }
}
 
Example 4
Project: hadoop-oss   File: MutableQuantiles.java   View Source Code Vote up 5 votes
/**
 * Instantiates a new {@link MutableQuantiles} for a metric that rolls itself
 * over on the specified time interval.
 * 
 * @param name
 *          of the metric
 * @param description
 *          long-form textual description of the metric
 * @param sampleName
 *          type of items in the stream (e.g., "Ops")
 * @param valueName
 *          type of the values
 * @param interval
 *          rollover interval (in seconds) of the estimator
 */
public MutableQuantiles(String name, String description, String sampleName,
    String valueName, int interval) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);

  numInfo = info(ucName + "Num" + usName, String.format(
      "Number of %s for %s with %ds interval", lsName, desc, interval));
  // Construct the MetricsInfos for the quantiles, converting to percentiles
  quantileInfos = new MetricsInfo[quantiles.length];
  String nameTemplate = ucName + "%dthPercentile" + uvName;
  String descTemplate = "%d percentile " + lvName + " with " + interval
      + " second interval for " + desc;
  for (int i = 0; i < quantiles.length; i++) {
    int percentile = (int) (100 * quantiles[i].quantile);
    quantileInfos[i] = info(String.format(nameTemplate, percentile),
        String.format(descTemplate, percentile));
  }

  estimator = new SampleQuantiles(quantiles);

  this.interval = interval;
  scheduler.scheduleAtFixedRate(new RolloverSample(this), interval, interval,
      TimeUnit.SECONDS);
}
 
Example 5
Project: sql-first-mapper   File: MiscUtils.java   View Source Code Vote up 5 votes
/**
 * Prepare camelcase name
 *
 * @param nameString string to convert to camel case
 * @return camelcase string
 */
public static String prepareNameString(String nameString) {
    nameString = underscores(nameString).replaceAll("\\W", "_").toLowerCase();
    nameString = Arrays.stream(nameString.split("_")).map(StringUtils::capitalize).collect(Collectors.joining());
    nameString = StringUtils.uncapitalize(nameString);
    return nameString;
}
 
Example 6
Project: hadoop   File: MutableQuantiles.java   View Source Code Vote up 5 votes
/**
 * Instantiates a new {@link MutableQuantiles} for a metric that rolls itself
 * over on the specified time interval.
 * 
 * @param name
 *          of the metric
 * @param description
 *          long-form textual description of the metric
 * @param sampleName
 *          type of items in the stream (e.g., "Ops")
 * @param valueName
 *          type of the values
 * @param interval
 *          rollover interval (in seconds) of the estimator
 */
public MutableQuantiles(String name, String description, String sampleName,
    String valueName, int interval) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);

  numInfo = info(ucName + "Num" + usName, String.format(
      "Number of %s for %s with %ds interval", lsName, desc, interval));
  // Construct the MetricsInfos for the quantiles, converting to percentiles
  quantileInfos = new MetricsInfo[quantiles.length];
  String nameTemplate = ucName + "%dthPercentile" + uvName;
  String descTemplate = "%d percentile " + lvName + " with " + interval
      + " second interval for " + desc;
  for (int i = 0; i < quantiles.length; i++) {
    int percentile = (int) (100 * quantiles[i].quantile);
    quantileInfos[i] = info(String.format(nameTemplate, percentile),
        String.format(descTemplate, percentile));
  }

  estimator = new SampleQuantiles(quantiles);

  this.interval = interval;
  scheduler.scheduleAtFixedRate(new RolloverSample(this), interval, interval,
      TimeUnit.SECONDS);
}
 
Example 7
Project: ditb   File: MutableHistogram.java   View Source Code Vote up 5 votes
public MutableHistogram(String name, String description) {
  this.name = StringUtils.capitalize(name);
  this.desc = StringUtils.uncapitalize(description);
  sample = new ExponentiallyDecayingSample(DEFAULT_SAMPLE_SIZE, DEFAULT_ALPHA);
  count = new AtomicLong();
  min = new AtomicLong(Long.MAX_VALUE);
  max = new AtomicLong(Long.MIN_VALUE);
  sum = new AtomicLong();
}
 
Example 8
Project: ditb   File: MetricMutableQuantiles.java   View Source Code Vote up 5 votes
/**
 * Instantiates a new {@link MetricMutableQuantiles} for a metric that rolls itself over on the
 * specified time interval.
 *
 * @param name        of the metric
 * @param description long-form textual description of the metric
 * @param sampleName  type of items in the stream (e.g., "Ops")
 * @param valueName   type of the values
 * @param interval    rollover interval (in seconds) of the estimator
 */
public MetricMutableQuantiles(String name, String description, String sampleName,
                              String valueName, int interval) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);

  numInfo = info(ucName + "Num" + usName, String.format(
      "Number of %s for %s with %ds interval", lsName, desc, interval));
  // Construct the MetricsInfos for the quantiles, converting to percentiles
  quantileInfos = new MetricsInfo[quantiles.length];
  String nameTemplate = "%s%dthPercentile%dsInterval%s";
  String descTemplate = "%d percentile %s with %d second interval for %s";
  for (int i = 0; i < quantiles.length; i++) {
    int percentile = (int) (100 * quantiles[i].quantile);
    quantileInfos[i] = info(String.format(nameTemplate, ucName, percentile, interval, uvName),
        String.format(descTemplate, percentile, lvName, interval, desc));
  }

  estimator = new MetricSampleQuantiles(quantiles);
  executor = new MetricsExecutorImpl();
  this.interval = interval;
  executor.getExecutor().scheduleAtFixedRate(new RolloverSample(this),
      interval,
      interval,
      TimeUnit.SECONDS);
}
 
Example 9
Project: Reer   File: TaskReportRenderer.java   View Source Code Vote up 4 votes
@Override
protected String createHeader(Project project) {
    String header = super.createHeader(project);
    return "All tasks runnable from " + StringUtils.uncapitalize(header);
}
 
Example 10
Project: Reer   File: DefaultSourceSet.java   View Source Code Vote up 4 votes
public String getCompileConfigurationName() {
    return StringUtils.uncapitalize(getTaskBaseName() + "Compile");
}
 
Example 11
Project: Reer   File: DefaultSourceSet.java   View Source Code Vote up 4 votes
public String getRuntimeConfigurationName() {
    return StringUtils.uncapitalize(getTaskBaseName() + "Runtime");
}
 
Example 12
Project: Reer   File: DefaultSourceSet.java   View Source Code Vote up 4 votes
public String getCompileOnlyConfigurationName() {
    return StringUtils.uncapitalize(getTaskBaseName() + "CompileOnly");
}
 
Example 13
Project: Reer   File: DefaultSourceSet.java   View Source Code Vote up 4 votes
@Override
public String getCompileClasspathConfigurationName() {
    return StringUtils.uncapitalize(getTaskBaseName() + "CompileClasspath");
}
 
Example 14
Project: lams   File: WebUtil.java   View Source Code Vote up 3 votes
/**
    * <p>
    * This helper method create the struts action forward name using the path. It will chop all path related
    * characters, such as "/" and ".do".
    * </p>
    *
    * <p>
    * For example:
    * <li><code>getStrutsForwardNameFromPath("/DisplayParallelActivity.do")<code>
    * = displayParallelActivity</li>
    * </p>
    *
    * @param path
    * @return
    */
   public static String getStrutsForwardNameFromPath(String path) {
String pathWithoutSlash = StringUtils.substringAfter(path, "/");
String orginalForwardName = StringUtils.substringBeforeLast(pathWithoutSlash, ".do");

return StringUtils.uncapitalize(orginalForwardName);

   }