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

net.sf.staccatocommons.util.apache.Escapes 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.StringEscapeUtils;

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


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


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


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


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


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


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


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


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


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


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


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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy