org.jpos.q2.QFactory.invoke()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.jpos.q2.QFactory.invoke方法的一些代码示例,展示了QFactory.invoke的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QFactory.invoke方法的具体详情如下:
包路径:org.jpos.q2.QFactory
类名称:QFactory
方法名:invoke

QFactory.invoke介绍

[英]Try to invoke a method (usually a setter) on the given object silently ignoring if method does not exist
[中]尝试在给定对象上调用方法(通常是setter),如果方法不存在,则忽略该方法

代码示例

代码示例来源:origin: jpos/jPOS

/**
* Try to invoke a method (usually a setter) on the given object
* silently ignoring if method does not exist
* @param obj the object
* @param m method to invoke
* @param p parameter
* @throws ConfigurationException if method happens to throw an exception
*/
public static void invoke (Object obj, String m, Object p) 
  throws ConfigurationException 
{
  invoke (obj, m, p, p != null ? p.getClass() : null);
}

代码示例来源:origin: jpos/jPOS

public void stopService() {
  Iterator keys = privateList.keySet().iterator();
  while (keys.hasNext()) {
    Element bean = (Element) privateList.get(keys.next());
    String id = bean.getAttributeValue("id");// id and key are same
    Object beanInstance=beanMap.remove(id);
    String stopMethod = bean.getAttributeValue("stop-method");
    if(beanInstance!=null && stopMethod!=null){
      try{
        QFactory.invoke(beanInstance, stopMethod, null);
      }catch(Exception e){
        log.warn(e);
      }
    }
  }
}

代码示例来源:origin: jpos/jPOS

public TransactionParticipant createParticipant (Element e) 
  throws ConfigurationException
{
  QFactory factory = getFactory();
  TransactionParticipant participant = (TransactionParticipant) 
    factory.newInstance (e.getAttributeValue ("class")
  );
  factory.setLogger (participant, e);
  QFactory.invoke (participant, "setTransactionManager", this, TransactionManager.class);
  factory.setConfiguration (participant, e);
  String realm = e.getAttributeValue("realm");
  if (realm != null && realm.trim().length() > 0)
    realm = ":" + realm;
  else
    realm = "";
  names.put(participant, Caller.shortClassName(participant.getClass().getName())+realm);
  if (participant instanceof Destroyable) {
    destroyables.add((Destroyable) participant);
  }
  return participant;
}

代码示例来源:origin: jpos/jPOS

+ pName.substring(1);
if (pValue == null) {
  QFactory.invoke(beanInstance, methodName, getBean(pRef));
} else {
  QFactory.invoke(beanInstance, methodName, pValue);
QFactory.invoke(beanInstance, startMethod, null);

代码示例来源:origin: jpos/jPOS

@Test
public void testInvoke3() throws Throwable {
  QFactory.invoke("", "testQFactorym", "");
  assertTrue("Test completed without Exception", true);
}

代码示例来源:origin: jpos/jPOS

@Test
public void testInvoke1() throws Throwable {
  QFactory.invoke(null, "testQFactorym", "testString", Integer.class);
  assertTrue("Test completed without Exception", true);
}

代码示例来源:origin: jpos/jPOS

@Test
public void testInvoke2() throws Throwable {
  QFactory.invoke("", "testQFactorym", null);
  assertTrue("Test completed without Exception", true);
}

代码示例来源:origin: jpos/jPOS

@Test
public void testInvoke() throws Throwable {
  QFactory.invoke("", "testQFactorym", "testString", Integer.class);
  assertTrue("Test completed without Exception", true);
}

代码示例来源:origin: jpos/jPOS

public ISOChannel newChannel (Element e, QFactory f) 
  throws ConfigurationException
{
  String channelName  = e.getAttributeValue ("class");
  String packagerName = e.getAttributeValue ("packager");
  ISOChannel channel   = (ISOChannel) f.newInstance (channelName);
  ISOPackager packager;
  if (packagerName != null) {
    packager = (ISOPackager) f.newInstance (packagerName);
    channel.setPackager (packager);
    f.setConfiguration (packager, e);
  }
  QFactory.invoke (channel, "setHeader", e.getAttributeValue ("header"));
  f.setLogger        (channel, e);
  f.setConfiguration (channel, e);
  if (channel instanceof FilteredChannel) {
    addFilters ((FilteredChannel) channel, e, f);
  }
  if (channel instanceof ExceptionHandlerAware) {
    addExceptionHandlers((ExceptionHandlerAware) channel, e, f);
  }
  if (getName () != null)
    channel.setName (getName ());
  return channel;
}

代码示例来源:origin: jpos/jPOS

private ISOChannel newChannel (Element e, QFactory f) 
  throws ConfigurationException
{
  String channelName  = e.getAttributeValue ("class");
  if (channelName == null)
    throw new ConfigurationException ("class attribute missing from channel element.");
  
  String packagerName = e.getAttributeValue ("packager");
  ISOChannel channel   = (ISOChannel) f.newInstance (channelName);
  ISOPackager packager;
  if (packagerName != null) {
    packager = (ISOPackager) f.newInstance (packagerName);
    channel.setPackager (packager);
    f.setConfiguration (packager, e);
  }
  QFactory.invoke (channel, "setHeader", e.getAttributeValue ("header"));
  f.setLogger        (channel, e);
  f.setConfiguration (channel, e);
  if (channel instanceof FilteredChannel) {
    addFilters ((FilteredChannel) channel, e, f);
  }
  if (getName () != null)
    channel.setName (getName ()+id);
  return channel;
}

代码示例来源:origin: jpos/jPOS

f.setConfiguration(packager, e);
QFactory.invoke(channel, "setHeader", e.getAttributeValue("header"));
f.setLogger(channel, e);
f.setConfiguration(channel, e);

相关文章