1 /*
2  * Hibernate Validator, declare and validate application constraints
3  *
4  * License: Apache License, Version 2.0
5  * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
6  */

7 package org.hibernate.validator.internal.properties;
8
9 import java.util.Arrays;
10
11 public final class Signature {
12
13     private final String name;
14
15     private final Class<?>[] parameterTypes;
16
17     public Signature(String name, Class<?>... parameterTypes) {
18         this.name = name;
19         this.parameterTypes = parameterTypes;
20     }
21
22     @Override
23     public boolean equals(Object obj) {
24         if ( obj == null ) {
25             return false;
26         }
27
28         // we can safely assume the type will always be the right one
29         Signature other = (Signature) obj;
30
31         if ( !this.name.equals( other.name ) ) {
32             return false;
33         }
34
35         return Arrays.equals( this.parameterTypes, other.parameterTypes );
36     }
37
38     @Override
39     public int hashCode() {
40         int result = name.hashCode();
41         result = 31 * result + Arrays.hashCode( parameterTypes );
42         return result;
43     }
44 }
45