Ejemplo n.º 1
0
 public MBeanInternalNotificationInfo(EventInfo eventInfo, IMBeanInfoFactory factory)
 {
     _handlerType            = eventInfo.GetAddMethod().GetParameters()[0].ParameterType;
     _handlerGenericArgument = _handlerType.GetGenericArguments()[0];
     if (_handlerType.GetGenericTypeDefinition() == typeof(EventHandler <>) &&
         (typeof(Notification).IsAssignableFrom(_handlerGenericArgument) ||
          typeof(NotificationEventArgs).IsAssignableFrom(_handlerGenericArgument)))
     {
         _notifInfo = factory.CreateMBeanNotificationInfo(eventInfo, _handlerType);
     }
     else
     {
         throw new NotCompliantMBeanException(eventInfo.DeclaringType.AssemblyQualifiedName);
     }
     _eventInfo = eventInfo;
 }
 public MBeanInternalNotificationInfo(EventInfo eventInfo, IMBeanInfoFactory factory)
 {
     _handlerType = eventInfo.GetAddMethod().GetParameters()[0].ParameterType;
      _handlerGenericArgument = _handlerType.GetGenericArguments()[0];
      if (_handlerType.GetGenericTypeDefinition() == typeof(EventHandler<>) &&
      (typeof(Notification).IsAssignableFrom(_handlerGenericArgument)
       || typeof(NotificationEventArgs).IsAssignableFrom(_handlerGenericArgument)))
      {
     _notifInfo = factory.CreateMBeanNotificationInfo(eventInfo, _handlerType);
      }
      else
      {
     throw new NotCompliantMBeanException(eventInfo.DeclaringType.AssemblyQualifiedName);
      }
      _eventInfo = eventInfo;
 }