PropertyVetoException

PropertyVetoException (속성 거부 예외)

속성에 대한 제안된 변경이 허용되지 않는 값을 나타낼 때 던져지는 예외예요. 제약(constrained) 속성의 값이 수용 불가능하면 거부(veto)하기 위해 사용돼요.

출처: Java API Reference

본문

PropertyVetoExceptionException을 상속하는 검사 예외예요. VetoableChangeListener.vetoableChange() 메서드가 속성 변경을 거부할 때 이 예외를 던져요. 이를 통해 다른 리스너나 변경 주체가 속성 변경을 취소할 수 있어요.

주요 생성자와 메서드는 다음과 같아요.

public PropertyVetoException(String mess, PropertyChangeEvent evt)

public PropertyChangeEvent getPropertyChangeEvent()
  • PropertyVetoException(mess, evt) — 오류 메시지와 거부된 변경을 설명하는 PropertyChangeEvent를 지정해 생성해요.
  • getPropertyChangeEvent() — 거부된 속성 변경에 대한 정보를 담은 이벤트 객체를 반환해요.

Serializable을 구현하므로 직렬화가 가능해요. 제약 속성을 가진 빈에서 값의 유효성을 검증하는 데 자주 사용돼요.

더 알아보기 (Learn more)

Java 공식 API