All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eweb4j.mvc.config.creator.IpImpl Maven / Gradle / Ivy

The newest version!
package org.eweb4j.mvc.config.creator;

import org.eweb4j.mvc.config.bean.FieldConfigBean;
import org.eweb4j.mvc.config.bean.ValidatorConfigBean;
import org.eweb4j.mvc.validator.Validators;
import org.eweb4j.mvc.validator.annotation.IP;
import org.eweb4j.util.CommonUtil;


public class IpImpl implements ValidatorCreator {

	private IP ann;

	public IpImpl(IP ann) {
		this.ann = ann;
	}

	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;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy