001    /**
002     * Copyright 2010-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.common.util.ignore;
017    
018    import org.apache.commons.lang3.StringUtils;
019    
020    public class PrefixSuffixIgnorer implements Ignore {
021    
022            String prefix;
023            String suffix;
024    
025            public PrefixSuffixIgnorer() {
026                    this(null, null);
027            }
028    
029            public PrefixSuffixIgnorer(String prefix, String suffix) {
030                    super();
031                    this.prefix = prefix;
032                    this.suffix = suffix;
033            }
034    
035            @Override
036            public boolean ignore(String line) {
037                    return StringUtils.startsWith(line, prefix) && StringUtils.endsWith(line, suffix);
038            }
039    
040            public String getPrefix() {
041                    return prefix;
042            }
043    
044            public void setPrefix(String prefix) {
045                    this.prefix = prefix;
046            }
047    
048            public String getSuffix() {
049                    return suffix;
050            }
051    
052            public void setSuffix(String suffix) {
053                    this.suffix = suffix;
054            }
055    
056    }