Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HV-1763 Switch to a string less approach for signature generation
- Loading branch information
Showing
8 changed files
with
88 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
engine/src/main/java/org/hibernate/validator/internal/properties/Signature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters