📄 abstractfieldvalidator.java
字号:
// Copyright 2005-2007 onetsoft.com
//
// 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 com.onetsoft.fastjsp.valid;
import com.onetsoft.fastjsp.util.StringUtils;
import com.onetsoft.fastjsp.util.Util;
/**
* 抽象域验证类
* 继承此类须实现{@link this#validate(com.onetsoft.fastjsp.PageCycle)},从而可实现一些复杂验证,如用户注册验证中检测用户是否存在等
* 若只是简单实现表单自动验证,则使用{@link FormFieldValidator}即可
*
* @author <a href="mailto:hgw@onetsoft.com">hgw</a>
* @see FormFieldValidator 实现表单自动验证
*/
public abstract class AbstractFieldValidator implements FieldValidator {
private String message = null;
public AbstractFieldValidator() {
}
public FieldValidator addValidator(Validator validator) {
return this;
}
public Validator[] getValidators() {
return Util.EMPTY_VALIDATORS;
}
public boolean isError() {
return message != null;
}
public String getMessage() {
return message;
}
/**
* 设置验证信息
* @param message
*/
public void setMessage(String message){
this.message=message;
}
public String getField() {
return StringUtils.EMPTY;
}
public String getDisplayName() {
return StringUtils.EMPTY;
}
public String toString() {
return message;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -