1 16 package org.springframework.binding.method; 17 18 import java.io.Serializable ; 19 20 import org.springframework.binding.expression.Expression; 21 import org.springframework.core.style.ToStringCreator; 22 import org.springframework.util.Assert; 23 import org.springframework.util.ObjectUtils; 24 25 31 public class Parameter implements Serializable { 32 33 36 private Class type; 37 38 42 private Expression name; 43 44 50 public Parameter(Class type, Expression name) { 51 Assert.notNull(name, "The parameter name expression is required"); 52 this.type = type; 53 this.name = name; 54 } 55 56 public Class getType() { 57 return type; 58 } 59 60 public Expression getName() { 61 return name; 62 } 63 64 public boolean equals(Object obj) { 65 if (!(obj instanceof Parameter)) { 66 return false; 67 } 68 Parameter other = (Parameter)obj; 69 return ObjectUtils.nullSafeEquals(type, other.type) && name.equals(other.name); 70 } 71 72 public int hashCode() { 73 return (type != null ? type.hashCode() : 0) + name.hashCode(); 74 } 75 76 public String toString() { 77 return new ToStringCreator(this).append("type", type).append("name", name).toString(); 78 } 79 } | Popular Tags |