org.chorusbdd.chorus.annotations.Handler.value()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(121)

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

Handler.value介绍

暂无

代码示例

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Create a StepInvoker from an instance of a class annotated with @Handler
 * @param handlerInstance
 */
public HandlerClassInvokerFactory(Object handlerInstance) {
  Objects.requireNonNull(handlerInstance, "Handler instance cannot be null");
  this.handlerInstance = handlerInstance;
  Class<?> handlerClazz = handlerInstance.getClass();
  Handler handlerAnnotation = handlerClazz.getAnnotation(Handler.class);
  this.handlerName = handlerAnnotation == null ? handlerClazz.getName() : handlerAnnotation.value();
}

代码示例来源:origin: Chorus-bdd/Chorus

private Object getHandlerResource(String resourceName, Iterable<Object> handlerInstances) {
  Object o = null;
  String handlerName = resourceName.substring(ChorusResource.handlerPrefix.length());
  for ( Object handlerInstance : handlerInstances) {
    Handler h = handlerInstance.getClass().getAnnotation(Handler.class);
    if ( handlerName.trim().toLowerCase().equals(h.value().trim().toLowerCase())) {
      o = handlerInstance;
      break;
    }
  }
  if ( o == null) {
    log.warn("Could not find a handler named " + handlerName +
        " to inject field annotated @ChorusResource(\"handler." + handlerName + "\", missing Uses: statement?");
  }
  return o;
}

代码示例来源:origin: Chorus-bdd/Chorus

public void createFeatureScopedHandlers() throws Exception {
  for (Class handlerClass : orderedHandlerClasses) {
    //create a new SCENARIO scoped handler
    Handler handlerAnnotation = (Handler) handlerClass.getAnnotation(Handler.class);
    if (handlerAnnotation.scope() != Scope.SCENARIO) { //feature or unmanaged
      Object handler = createAndInitHandlerInstance(handlerClass);
      featureScopedHandlers.put(handlerClass, handler);
      log.debug("Created new feature scoped handler: " + handlerAnnotation.value());
    }
  }    
}

代码示例来源:origin: Chorus-bdd/Chorus

for (Class handlerClass : classes) {
  Handler f = (Handler) handlerClass.getAnnotation(Handler.class);
  String handlerName = f.value();
  if (handlerNameToHandlerClass.containsKey(handlerName)) {
    String currentHandler = handlerNameToHandlerClass.get(handlerName).getName();

相关文章