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

org.hibernate.validator.internal.constraintvalidators.hv.pl.NIPValidator Maven / Gradle / Ivy

Go to download

JSR 380's RI, Hibernate Validator version ${hibernate-validator.version} and its dependencies repackaged as OSGi bundle

There is a newer version: 5.1.0
Show newest version
/*
 * Hibernate Validator, declare and validate application constraints
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or .
 */
package org.hibernate.validator.internal.constraintvalidators.hv.pl;

import java.util.List;

import org.hibernate.validator.constraints.pl.NIP;

/**
 * Validator for {@link NIP}.
 *
 * @author Marko Bekhta
 */
public class NIPValidator extends PolishNumberValidator {

	private static final int[] WEIGHTS_NIP = { 6, 5, 7, 2, 3, 4, 5, 6, 7 };


	@Override
	public void initialize(NIP constraintAnnotation) {
		super.initialize(
				0,
				Integer.MAX_VALUE,
				-1,
				true
		);
	}

	@Override
	protected int[] getWeights(List digits) {
		return WEIGHTS_NIP;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy