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

org.hibernate.validator.internal.properties.Signature Maven / Gradle / Ivy

There is a newer version: 8.0.1.Final
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.properties;

import java.util.Arrays;

public final class Signature {

	private final String name;

	private final Class[] parameterTypes;

	public Signature(String name, Class... parameterTypes) {
		this.name = name;
		this.parameterTypes = parameterTypes;
	}

	@Override
	public boolean equals(Object obj) {
		if ( obj == null ) {
			return false;
		}

		// we can safely assume the type will always be the right one
		Signature other = (Signature) obj;

		if ( !this.name.equals( other.name ) ) {
			return false;
		}

		return Arrays.equals( this.parameterTypes, other.parameterTypes );
	}

	@Override
	public int hashCode() {
		int result = name.hashCode();
		result = 31 * result + Arrays.hashCode( parameterTypes );
		return result;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy