Class EventCastUtil


  • public final class EventCastUtil
    extends java.lang.Object
    Utility class to cast a ZK event Event to needed event class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends org.zkoss.zk.ui.event.Event>
      T
      cast​(org.zkoss.zk.ui.event.Event event, java.lang.Class<T> type)
      Converts the given event to the needed type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • cast

        public static <T extends org.zkoss.zk.ui.event.Event> T cast​(org.zkoss.zk.ui.event.Event event,
                                                                     java.lang.Class<T> type)
        Converts the given event to the needed type.

        If cast of event fails a IllegalArgumentException is thrown.

        Type Parameters:
        T - the generic type for the conversion
        Parameters:
        event - the event to convert
        type - the generic type to cast for the given event
        Returns:
        the casted event or throws IllegalArgumentException if cast fails