All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.staccatocommons.util.apache.Words Maven / Gradle / Ivy

The newest version!
/**
 *  Copyright (c) 2010-2012, The StaccatoCommons Team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation; version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 */

/////////////////////////////////////////////////
///// WARNING: GENERATE CODE. DO NOT EDIT ///////
/////////////////////////////////////////////////

package net.sf.staccatocommons.util.apache;

import net.sf.staccatocommons.defs.NullSafe;
import net.sf.staccatocommons.defs.function.Function;
import net.sf.staccatocommons.defs.predicate.Predicate;
import net.sf.staccatocommons.lang.function.internal.TopLevelFunction;
import net.sf.staccatocommons.lang.predicate.internal.TopLevelPredicate;

import org.apache.commons.lang.WordUtils;

/***
 * {@link Function}s and {@link Predicate}s based on Apache {@link WordUtils}. 
 * They provide a 1-1 mapping to that utility class. 
 */
public final class Words {


  /**
   * @see WordUtils#swapCase(String)
   */
  @NullSafe
  public static Function swapCase() {
    class ApacheSwapCaseFunction extends TopLevelFunction {
      private static final long serialVersionUID = 1L;
      public String apply(String arg) {
        return WordUtils.swapCase(arg);
      }
    }
    return new ApacheSwapCaseFunction();
  }


  /**
   * @see WordUtils#capitalize(String)
   */
  @NullSafe
  public static Function capitalize() {
    class ApacheCapitalizeFunction extends TopLevelFunction {
      private static final long serialVersionUID = 1L;
      public String apply(String arg) {
        return WordUtils.capitalize(arg);
      }
    }
    return new ApacheCapitalizeFunction();
  }


  /**
   * @see WordUtils#uncapitalize(String)
   */
  @NullSafe
  public static Function uncapitalize() {
    class ApacheUncapitalizeFunction extends TopLevelFunction {
      private static final long serialVersionUID = 1L;
      public String apply(String arg) {
        return WordUtils.uncapitalize(arg);
      }
    }
    return new ApacheUncapitalizeFunction();
  }


  /**
   * @see WordUtils#capitalizeFully(String)
   */
  @NullSafe
  public static Function capitalizeFully() {
    class ApacheCapitalizeFullyFunction extends TopLevelFunction {
      private static final long serialVersionUID = 1L;
      public String apply(String arg) {
        return WordUtils.capitalizeFully(arg);
      }
    }
    return new ApacheCapitalizeFullyFunction();
  }


  /**
   * @see WordUtils#initials(String)
   */
  @NullSafe
  public static Function initials() {
    class ApacheInitialsFunction extends TopLevelFunction {
      private static final long serialVersionUID = 1L;
      public String apply(String arg) {
        return WordUtils.initials(arg);
      }
    }
    return new ApacheInitialsFunction();
  }
 
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy