com.databasesandlife.util.wicket.MaxWordCountValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
Utility classes developed at Adrian Smith Software (A.S.S.)
package com.databasesandlife.util.wicket;
import org.apache.wicket.validation.IValidatable;
import org.apache.wicket.validation.validator.AbstractRangeValidator;
/**
* @author This source is copyright Adrian Smith and licensed under the LGPL 3.
* @see Project on GitHub
*/
@SuppressWarnings("serial")
public class MaxWordCountValidator extends AbstractRangeValidator {
public MaxWordCountValidator(int maxWords) {
super(null, maxWords);
}
@Override protected Integer getValue(IValidatable x) {
return x.getValue().split("\\s+").length;
}
}