use of org.eweb4j.mvc.config.bean.ValidatorConfigBean in project eweb4j-framework by laiweiwei.
the class IDCardImpl method create.
public ValidatorConfigBean create(String fieldName, ValidatorConfigBean val) {
if (this.ann == null)
return null;
if (val == null || !Validators.ID_CARD.equals(val.getName())) {
val = new ValidatorConfigBean();
val.setName(Validators.ID_CARD);
}
FieldConfigBean fcb = new FieldConfigBean();
fcb.setName(fieldName);
fcb.setMessage(CommonUtil.parsePropValue(ann.mess()));
val.getField().add(fcb);
return val;
}
use of org.eweb4j.mvc.config.bean.ValidatorConfigBean in project eweb4j-framework by laiweiwei.
the class IpImpl method create.
public ValidatorConfigBean create(String fieldName, ValidatorConfigBean val) {
if (this.ann == null)
return null;
if (val == null || !Validators.IP.equals(val.getName())) {
val = new ValidatorConfigBean();
val.setName(Validators.IP);
}
FieldConfigBean fcb = new FieldConfigBean();
fcb.setName(fieldName);
fcb.setMessage(CommonUtil.parsePropValue(ann.mess()));
val.getField().add(fcb);
return val;
}
use of org.eweb4j.mvc.config.bean.ValidatorConfigBean in project eweb4j-framework by laiweiwei.
the class LengthImpl method create.
public ValidatorConfigBean create(String fieldName, ValidatorConfigBean val) {
if (this.ann == null)
return null;
if (val == null || !Validators.LENGTH.equals(val.getName())) {
val = new ValidatorConfigBean();
val.setName(Validators.LENGTH);
}
FieldConfigBean fcb = new FieldConfigBean();
fcb.setName(fieldName);
fcb.setMessage(CommonUtil.parsePropValue(ann.mess()));
ParamConfigBean pcb = new ParamConfigBean();
pcb.setName(Validators.MIN_LENGTH_PARAM);
pcb.setValue(String.valueOf(ann.min()));
fcb.getParam().add(pcb);
ParamConfigBean pcb2 = new ParamConfigBean();
pcb2.setName(Validators.MAX_LENGTH_PARAM);
pcb2.setValue(String.valueOf(ann.max()));
fcb.getParam().add(pcb2);
val.getField().add(fcb);
return val;
}
use of org.eweb4j.mvc.config.bean.ValidatorConfigBean in project eweb4j-framework by laiweiwei.
the class MyValidatorImpl method create.
public ValidatorConfigBean create(String fieldName, ValidatorConfigBean val) {
if (this.ann == null)
return null;
Class<?> clazz = this.ann.clazz();
String valName = clazz.getSimpleName();
if (val == null || !valName.equals(val.getName())) {
val = new ValidatorConfigBean();
val.setName(valName);
val.setClazz(clazz.getName());
}
FieldConfigBean fcb = new FieldConfigBean();
fcb.setName(fieldName);
fcb.setMessage(CommonUtil.parsePropValue(ann.mess()));
String[] params = ann.params();
String[] values = ann.values();
if (params.length > 0 && values.length > 0 && params.length == values.length) {
for (int i = 0; i < params.length; i++) {
ParamConfigBean pcb = new ParamConfigBean();
pcb.setName(CommonUtil.parsePropValue(params[i]));
pcb.setValue(CommonUtil.parsePropValue(values[i]));
fcb.getParam().add(pcb);
}
}
val.getField().add(fcb);
return val;
}
use of org.eweb4j.mvc.config.bean.ValidatorConfigBean in project eweb4j-framework by laiweiwei.
the class PhoneImpl method create.
public ValidatorConfigBean create(String fieldName, ValidatorConfigBean val) {
if (this.ann == null)
return null;
if (val == null || !Validators.PHONE.equals(val.getName())) {
val = new ValidatorConfigBean();
val.setName(Validators.PHONE);
}
FieldConfigBean fcb = new FieldConfigBean();
fcb.setName(fieldName);
fcb.setMessage(CommonUtil.parsePropValue(ann.mess()));
val.getField().add(fcb);
return val;
}
Aggregations