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

jodd.vtor.constraint.NotBlankConstraint Maven / Gradle / Ivy

There is a newer version: 5.3.0
Show newest version
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.vtor.constraint;

import jodd.util.StringUtil;
import jodd.vtor.ValidationConstraint;
import jodd.vtor.ValidationConstraintContext;

public class NotBlankConstraint implements ValidationConstraint {

	// ---------------------------------------------------------------- configure

	public void configure(NotBlank annotation) {
	}

	// ---------------------------------------------------------------- valid

	public boolean isValid(ValidationConstraintContext vcc, Object value) {
		return validate(value);
	}

	public static boolean validate(Object value) {
		if (value == null) {
			return true;
		}
		return StringUtil.isNotBlank(value.toString());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy