/**
* Copyright 2014 SAP AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.aim.mainagent.utils;
import java.util.Arrays;
/**
* Represents a method.
*
* @author Alexander Wert
*
*/
public class MethodSignature {
private String methodName;
private Class<?>[] parameters;
/**
* Constructor.
*
* @param methodName
* simple name of the method
* @param parameters
* array of classes representing the parameter types
*/
public MethodSignature(String methodName, Class<?>[] parameters) {
super();
this.methodName = methodName;
this.parameters = parameters;
}
/**
* @return the methodName
*/
public String getMethodName() {
return methodName;
}
/**
* @param methodName
* the methodName to set
*/
public void setMethodName(String methodName) {
this.methodName = methodName;
}
/**
* @return the parameters
*/
public Class<?>[] getParameters() {
return parameters;
}
/**
* @param parameters
* the parameters to set
*/
public void setParameters(Class<?>[] parameters) {
this.parameters = parameters;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((methodName == null) ? 0 : methodName.hashCode());
result = prime * result + Arrays.hashCode(parameters);
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MethodSignature other = (MethodSignature) obj;
if (methodName == null) {
if (other.methodName != null) {
return false;
}
} else if (!methodName.equals(other.methodName)) {
return false;
}
if (!Arrays.equals(parameters, other.parameters)) {
return false;
}
return true;
}
}