Add eqauls and hashCode to FunctionName

This commit is contained in:
Volker Berlin 2018-11-24 21:02:30 +01:00
parent d8de454a3f
commit eaeb09ee48

View File

@ -31,11 +31,13 @@ public class FunctionName {
/**
* The name in the WebAssembly.
*/
@Nonnull
public final String fullName;
/**
* The Java signature which is used in Java byte code to reference the method call.
*/
@Nonnull
public final String signatureName;
/**
@ -50,4 +52,30 @@ public class FunctionName {
fullName = className + '.' + methodName;
signatureName = fullName + methodOrField.getType();
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return signatureName.hashCode();
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals( Object obj ) {
if( this == obj ) {
return true;
}
if( obj == null ) {
return false;
}
if( getClass() != obj.getClass() ) {
return false;
}
FunctionName other = (FunctionName)obj;
return signatureName.equals( other.signatureName );
}
}