equals 덮어쓰기 방법에 대한 주의사항

728 단어 equals
public abstract class AbstractPointcutAdvisor
{
@Override
	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof PointcutAdvisor)) {
			return false;
		}
		PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
		return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
				ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
	}

	@Override
	public int hashCode() {
		return PointcutAdvisor.class.hashCode();
	}
}

other instanceof PointcutAdvisor에서 유형을 판단해야 합니다. 이 유형이 아닌 클래스 전송이 있을 수 있습니다.

좋은 웹페이지 즐겨찾기