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

org.nutz.validate.impl.IntValueValidator Maven / Gradle / Ivy

Go to download

Nutz, which is a collections of lightweight frameworks, each of them can be used independently

There is a newer version: 1.r.72
Show newest version
package org.nutz.validate.impl;

import org.nutz.castor.Castors;
import org.nutz.validate.NutValidateException;
import org.nutz.validate.NutValidator;

public class IntValueValidator implements NutValidator {

    private int N;

    public IntValueValidator(Object any) {
        this.N = Castors.me().castTo(any, Integer.class);
    }

    @Override
    public Object check(Object val) throws NutValidateException {
        if (null == val) {
            return null;
        }
        int v = Castors.me().castTo(val, Integer.class);
        return this.N == v;
    }

    @Override
    public int order() {
        return 1000;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy