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

com.databasesandlife.util.wicket.MaxWordCountValidator Maven / Gradle / Ivy

There is a newer version: 21.0.1
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy