Matcher.java :  » Web-Framework » calyxo » de » odysseus » calyxo » forms » Java Open Source

Java Open Source » Web Framework » calyxo 
calyxo » de » odysseus » calyxo » forms » Matcher.java
/*
 * Copyright 2004, 2005, 2006 Odysseus Software GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 
package de.odysseus.calyxo.forms;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;


/**
 * Matcher interface.
 * A matcher handles string-to-string conversions (substring, pattern-matching, ...).
 * Implementors must have an empty constructor. Additionally to the
 * methods required for a validation engine they have to implement the
 * {@link #match(HttpServletRequest, String)} method.
 *
 * @author Christoph Beck
 * @author Oliver Stuhr
 */
public interface Matcher extends ValidatorBase {
  /**
   * Static "do-nothing" matcher instance
   */
  public static final Matcher IDENTITY = new Matcher() {
    public String match(HttpServletRequest request, String value) {
      return value;
    }
    public void localize(Locale locale) {
    }
    public boolean isSharable() {
      return true;
    }
  };

  /**
   * Match specified value.
   * @return result string
   */
  public String match(HttpServletRequest request, String value);
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.