1 16 package org.springframework.binding.method; 17 18 import java.io.Serializable ; 19 20 import org.springframework.core.style.ToStringCreator; 21 import org.springframework.util.Assert; 22 23 29 public class MethodSignature implements Serializable { 30 31 34 private String methodName; 35 36 39 private Parameters parameters; 40 41 45 public MethodSignature(String methodName) { 46 this(methodName, Parameters.NONE); 47 } 48 49 54 public MethodSignature(String methodName, Parameter parameter) { 55 this(methodName, new Parameters(parameter)); 56 } 57 58 63 public MethodSignature(String methodName, Parameters parameters) { 64 Assert.notNull(methodName, "The method name is required"); 65 Assert.notNull(parameters, "The parameters are required"); 66 this.methodName = methodName; 67 this.parameters = parameters; 68 } 69 70 public Parameters getParameters() { 71 return parameters; 72 } 73 74 public String getMethodName() { 75 return methodName; 76 } 77 78 public boolean equals(Object obj) { 79 if (!(obj instanceof MethodSignature)) { 80 return false; 81 } 82 MethodSignature other = (MethodSignature)obj; 83 return methodName.equals(methodName) && parameters.equals(other.parameters); 84 } 85 86 public int hashCode() { 87 return methodName.hashCode() + parameters.hashCode(); 88 } 89 90 public String toString() { 91 return new ToStringCreator(this).append("methodName", methodName).append("parameters", parameters).toString(); 92 } 93 } | Popular Tags |