
com.databasesandlife.util.wicket.MaxWordCountValidator Maven / Gradle / Ivy
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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy