Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 package org.tigris.scarab.util.comparators;2 3 /* ================================================================4 * Copyright (c) 2000-2002 CollabNet. All rights reserved.5 * 6 * Redistribution and use in source and binary forms, with or without7 * modification, are permitted provided that the following conditions are8 * met:9 * 10 * 1. Redistributions of source code must retain the above copyright11 * notice, this list of conditions and the following disclaimer.12 * 13 * 2. Redistributions in binary form must reproduce the above copyright14 * notice, this list of conditions and the following disclaimer in the15 * documentation and/or other materials provided with the distribution.16 * 17 * 3. The end-user documentation included with the redistribution, if18 * any, must include the following acknowlegement: "This product includes19 * software developed by Collab.Net <http://www.Collab.Net/>."20 * Alternately, this acknowlegement may appear in the software itself, if21 * and wherever such third-party acknowlegements normally appear.22 * 23 * 4. The hosted project names must not be used to endorse or promote24 * products derived from this software without prior written25 * permission. For written permission, please contact info@collab.net.26 * 27 * 5. Products derived from this software may not use the "Tigris" or 28 * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without 29 * prior written permission of Collab.Net.30 * 31 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED32 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF33 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.34 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY35 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE37 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER39 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR40 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF41 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.42 *43 * ====================================================================44 * 45 * This software consists of voluntary contributions made by many46 * individuals on behalf of Collab.Net.47 */48 49 importorg.apache.commons.collections.Predicate;50 /**51 * Returns only strings that start with a specific string!52 * Good for filtering through a long list of paramerters and53 * only getting some back.54 *55 *@author epugh56 *@created May 5, 200257 */58 publicclass StartsWithPredicate implementsPredicate59 {60 privateString startsWith;61 public StartsWithPredicate(String startsWith)62 {63 this.startsWith = startsWith;64 }65 /**66 * Takes in the input object, and call's it's toString method.67 * Then checks if it starts with the value.68 */69 publicboolean evaluate(Object input)70 {71 return (input.toString().startsWith(startsWith));72 }73 }74