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

Java Open Source » Web Framework » calyxo 
calyxo » de » odysseus » calyxo » forms » Checker.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;


/**
 * Checker interface.
 * A checker takes an already matched and converted value and tests it.
 * Implementors must have an empty constructor. Additionally to the
 * methods required for a validation engine they have to implement the
 * {@link #check(HttpServletRequest, Object)} method.
 *
 * @author Christoph Beck
 * @author Oliver Stuhr
 */
public interface Checker extends ValidatorBase {
  /**
   * Static "do-nothing" checker instance
   */
  public static final Checker TRUE = new Checker() {
    public boolean check(HttpServletRequest request, Object value) {
      return true;
    }
    public void localize(Locale locale) {
    }
    public boolean isSharable() {
      return true;
    }
  };

  /**
   * Check the specified value (to be implemented by subclasses)
   */
  public boolean check(HttpServletRequest request, Object 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.