當前位置: 首頁>>代碼示例>>Java>>正文


Java EventSetDescriptor.getAddListenerMethod方法代碼示例

本文整理匯總了Java中java.beans.EventSetDescriptor.getAddListenerMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java EventSetDescriptor.getAddListenerMethod方法的具體用法?Java EventSetDescriptor.getAddListenerMethod怎麽用?Java EventSetDescriptor.getAddListenerMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.beans.EventSetDescriptor的用法示例。


在下文中一共展示了EventSetDescriptor.getAddListenerMethod方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: __createMergedEventSetStub

import java.beans.EventSetDescriptor; //導入方法依賴的package包/類
static EventSetDescriptor __createMergedEventSetStub(
  EventSetDescriptor oldDescriptor,
  MethodDescriptor[] listenerDescriptors
  )
{
  try
  {
    EventSetDescriptor stubDescriptor = new EventSetDescriptor(
                                  oldDescriptor.getName(),
                                  oldDescriptor.getListenerType(),
                                  listenerDescriptors,
                                  oldDescriptor.getAddListenerMethod(),
                                  oldDescriptor.getRemoveListenerMethod());

    // set the unicast attribute
    stubDescriptor.setUnicast(oldDescriptor.isUnicast());

    return stubDescriptor;
  }
  catch (Exception e)
  {
    //    _LOG.severe(e);
    return null;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:JavaIntrospector.java

示例2: setResourceListeners

import java.beans.EventSetDescriptor; //導入方法依賴的package包/類
/**
 * Adds listeners to a resource.
 * @param listeners The listeners to be registered with the resource. A
 * {@link java.util.Map} that maps from fully qualified class name (as a
 * string) to listener (of the type declared by the key).
 * @param resource the resource that listeners will be registered to.
 */
public static void setResourceListeners(Resource resource, Map<String, ? extends Object> listeners)
throws
  IntrospectionException, InvocationTargetException,
  IllegalAccessException, GateException
{
  // get the beaninfo for the resource bean, excluding data about Object
  BeanInfo resBeanInfo = getBeanInfo(resource.getClass());

  // get all the events the bean can fire
  EventSetDescriptor[] events = resBeanInfo.getEventSetDescriptors();

  // add the listeners
  if (events != null) {
    EventSetDescriptor event;
    for(int i = 0; i < events.length; i++) {
      event = events[i];

      // did we get such a listener?
      Object listener =
        listeners.get(event.getListenerType().getName());
      if(listener != null) {
        Method addListener = event.getAddListenerMethod();

        // call the set method with the parameter value
        Object[] args = new Object[1];
        args[0] = listener;
        addListener.invoke(resource, args);
      }
    } // for each event
  }   // if events != null
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:39,代碼來源:AbstractResource.java

示例3: BeanConnection

import java.beans.EventSetDescriptor; //導入方法依賴的package包/類
/**
 * Creates a new <code>BeanConnection</code> instance.
 * 
 * @param source the source bean
 * @param target the target bean
 * @param esd the EventSetDescriptor for the connection be displayed
 */
public BeanConnection(BeanInstance source, BeanInstance target,
  EventSetDescriptor esd, Integer... tab) {

  int tabIndex = 0;
  if (tab.length > 0) {
    tabIndex = tab[0].intValue();
  }

  Vector<BeanConnection> connections = TABBED_CONNECTIONS.get(tabIndex);

  m_source = source;
  m_target = target;
  // m_sourceEsd = sourceEsd;
  m_eventName = esd.getName();
  // System.err.println(m_eventName);

  // attempt to connect source and target beans
  Method registrationMethod =
  // m_sourceEsd.getAddListenerMethod();
  // getSourceEventSetDescriptor().getAddListenerMethod();
  esd.getAddListenerMethod();
  Object targetBean = m_target.getBean();

  Object[] args = new Object[1];
  args[0] = targetBean;
  Class<?> listenerClass = esd.getListenerType();
  if (listenerClass.isInstance(targetBean)) {
    try {
      registrationMethod.invoke(m_source.getBean(), args);
      // if the target implements BeanCommon, then inform
      // it that it has been registered as a listener with a source via
      // the named listener interface
      if (targetBean instanceof BeanCommon) {
        ((BeanCommon) targetBean).connectionNotification(esd.getName(),
          m_source.getBean());
      }
      connections.addElement(this);
    } catch (Exception ex) {
      System.err.println("[BeanConnection] Unable to connect beans");
      ex.printStackTrace();
    }
  } else {
    System.err.println("[BeanConnection] Unable to connect beans");
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:53,代碼來源:BeanConnection.java


注:本文中的java.beans.EventSetDescriptor.getAddListenerMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。