277 278 /** 279 * Compare this MBeanOperationInfo to another. 280 * 281 * @param o the object to compare to. 282 * 283 * @return true if and only if <code>o</code> is an MBeanOperationInfo such 284 * that its {@link #getName()}, {@link #getReturnType()}, {@link 285 * #getDescription()}, {@link #getImpact()}, {@link #getDescriptor()} 286 * and {@link #getSignature()} values are equal (not necessarily identical) 287 * to those of this MBeanConstructorInfo. Two signature arrays 288 * are equal if their elements are pairwise equal. 289 */ 290 @Override 291 public boolean equals(Object o) { 292 if (o == this) 293 return true; 294 if (!(o instanceof MBeanOperationInfo)) 295 return false; 296 MBeanOperationInfo p = (MBeanOperationInfo) o; 297 return (p.getName().equals(getName()) && 298 p.getReturnType().equals(getReturnType()) && 299 p.getDescription().equals(getDescription()) && 300 p.getImpact() == getImpact() && 301 Arrays.equals(p.fastGetSignature(), fastGetSignature()) && 302 p.getDescriptor().equals(getDescriptor())); 303 } 304 305 /* We do not include everything in the hashcode. We assume that 306 if two operations are different they'll probably have different 307 names or types. The penalty we pay when this assumption is 308 wrong should be less than the penalty we would pay if it were 309 right and we needlessly hashed in the description and the 310 parameter array. */ 311 @Override 312 public int hashCode() { 313 return Objects.hash(getName(), getReturnType()); 314 } 315 316 private static MBeanParameterInfo[] methodSignature(Method method) { 317 final Class<?>[] classes = method.getParameterTypes(); 318 final Annotation[][] annots = method.getParameterAnnotations(); 319 return parameters(classes, annots); 320 } 321 322 static MBeanParameterInfo[] parameters(Class<?>[] classes, | 277 278 /** 279 * Compare this MBeanOperationInfo to another. 280 * 281 * @param o the object to compare to. 282 * 283 * @return true if and only if <code>o</code> is an MBeanOperationInfo such 284 * that its {@link #getName()}, {@link #getReturnType()}, {@link 285 * #getDescription()}, {@link #getImpact()}, {@link #getDescriptor()} 286 * and {@link #getSignature()} values are equal (not necessarily identical) 287 * to those of this MBeanConstructorInfo. Two signature arrays 288 * are equal if their elements are pairwise equal. 289 */ 290 @Override 291 public boolean equals(Object o) { 292 if (o == this) 293 return true; 294 if (!(o instanceof MBeanOperationInfo)) 295 return false; 296 MBeanOperationInfo p = (MBeanOperationInfo) o; 297 return (Objects.equals(p.getName(), getName()) && 298 Objects.equals(p.getReturnType(), getReturnType()) && 299 Objects.equals(p.getDescription(), getDescription()) && 300 p.getImpact() == getImpact() && 301 Arrays.equals(p.fastGetSignature(), fastGetSignature()) && 302 Objects.equals(p.getDescriptor(), getDescriptor())); 303 } 304 305 /* We do not include everything in the hashcode. We assume that 306 if two operations are different they'll probably have different 307 names or types. The penalty we pay when this assumption is 308 wrong should be less than the penalty we would pay if it were 309 right and we needlessly hashed in the description and the 310 parameter array. */ 311 @Override 312 public int hashCode() { 313 return Objects.hash(getName(), getReturnType()); 314 } 315 316 private static MBeanParameterInfo[] methodSignature(Method method) { 317 final Class<?>[] classes = method.getParameterTypes(); 318 final Annotation[][] annots = method.getParameterAnnotations(); 319 return parameters(classes, annots); 320 } 321 322 static MBeanParameterInfo[] parameters(Class<?>[] classes, |