/* * [TrimOption.java] * * Summary: enumeration to describe what sort of trimming you want done with leading and trailing blanks. * * Copyright: (c) 2002-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 4.5 2009-02-26 add both Java string quoting and plain for Java search/regexes. */ package com.mindprod.quoter; /** * enumeration to describe what sort of trimming you want done with leading and trailing blanks. * * @author Roedy Green, Canadian Mind Products * @version 4.5 2009-02-26 add both Java string quoting and plain for Java search/regexes. * @since 2002-06-19 */ public enum TrimOption { // don't reorder these! /** * trim both leading and trailing spaces. */ TRIM( new Trim(), "trim both leading and trailing spaces" ), /** * trim trailing spaces. */ TRIM_TRAILING( new TrimTrailing(), "trim trailing spaces" ), /** * keep spaces. */ KEEP_SPACES( null, "keep spaces" ), /** * trim leaning spaces. */ TRIM_LEADING( new TrimLeading(), "trim leading spaces" ); /** * description of this trimming option. */ private final String desc; /** * Object that can do this sort of trim. */ private final TextProcessor processor; private TrimOption( TextProcessor processor, String desc ) { this.processor = processor; this.desc = desc; } /** * Get pre processor that does pre-trim. * * @return preProcessor for this trim . */ public TextProcessor getProcessor() { return processor; } /** * get human-readable description of this trimming option. * * @return description. */ public String toString() { return desc; } }