org.springframework.core.annotation.Order.value()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(166)

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

Order.value介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

private static int resolveOrder(Method method) {
  Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
  return (ann != null ? ann.value() : 0);
}

代码示例来源:origin: org.springframework/spring-context

private int resolveOrder(Method method) {
  Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
  return (ann != null ? ann.value() : 0);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return the order on the specified {@code type}.
 * <p>Takes care of {@link Order @Order} and {@code @javax.annotation.Priority}.
 * @param type the type to handle
 * @return the order value, or {@code null} if none can be found
 * @see #getPriority(Class)
 */
@Nullable
public static Integer getOrder(Class<?> type) {
  Object cached = orderCache.get(type);
  if (cached != null) {
    return (cached instanceof Integer ? (Integer) cached : null);
  }
  Order order = AnnotationUtils.findAnnotation(type, Order.class);
  Integer result;
  if (order != null) {
    result = order.value();
  }
  else {
    result = getPriority(type);
  }
  orderCache.put(type, (result != null ? result : NOT_ANNOTATED));
  return result;
}

代码示例来源:origin: spring-projects/spring-security

private static int lookupOrder(Object obj) {
    if (obj instanceof Ordered) {
      return ((Ordered) obj).getOrder();
    }
    if (obj != null) {
      Class<?> clazz = (obj instanceof Class ? (Class<?>) obj : obj.getClass());
      Order order = AnnotationUtils.findAnnotation(clazz, Order.class);
      if (order != null) {
        return order.value();
      }
    }
    return Ordered.LOWEST_PRECEDENCE;
  }
}

代码示例来源:origin: org.springframework/spring-core

/**
 * Return the order on the specified {@code type}.
 * <p>Takes care of {@link Order @Order} and {@code @javax.annotation.Priority}.
 * @param type the type to handle
 * @return the order value, or {@code null} if none can be found
 * @see #getPriority(Class)
 */
@Nullable
public static Integer getOrder(Class<?> type) {
  Object cached = orderCache.get(type);
  if (cached != null) {
    return (cached instanceof Integer ? (Integer) cached : null);
  }
  Order order = AnnotationUtils.findAnnotation(type, Order.class);
  Integer result;
  if (order != null) {
    result = order.value();
  }
  else {
    result = getPriority(type);
  }
  orderCache.put(type, (result != null ? result : NOT_ANNOTATED));
  return result;
}

代码示例来源:origin: spring-projects/spring-framework

Order ann = AnnotationUtils.findAnnotation((Method) obj, Order.class);
if (ann != null) {
  return ann.value();
Order ann = AnnotationUtils.getAnnotation((AnnotatedElement) obj, Order.class);
if (ann != null) {
  return ann.value();

代码示例来源:origin: org.springframework/spring-core

Order ann = AnnotationUtils.findAnnotation((Method) obj, Order.class);
if (ann != null) {
  return ann.value();
Order ann = AnnotationUtils.getAnnotation((AnnotatedElement) obj, Order.class);
if (ann != null) {
  return ann.value();

代码示例来源:origin: jamesagnew/hapi-fhir

private int determineOrder(Class<?> theInterceptorClass) {
  int typeOrder = DEFAULT_ORDER;
  Order typeOrderAnnotation = AnnotationUtils.findAnnotation(theInterceptorClass, Order.class);
  if (typeOrderAnnotation != null) {
    typeOrder = typeOrderAnnotation.value();
  }
  return typeOrder;
}

代码示例来源:origin: paoding-code/paoding-rose

@Override
  public int compare(Interpreter thees, Interpreter that) {
    Order thessOrder = thees.getClass().getAnnotation(Order.class);
    Order thatOrder = that.getClass().getAnnotation(Order.class);
    int thessValue = thessOrder == null ? 0 : thessOrder.value();
    int thatValue = thatOrder == null ? 0 : thatOrder.value();
    return thessValue - thatValue;
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void sortByOrderAnnotation(List<Object> theObjects) {
  IdentityHashMap<Object, Integer> interceptorToOrder = new IdentityHashMap<>();
  for (Object next : theObjects) {
    Order orderAnnotation = next.getClass().getAnnotation(Order.class);
    int order = orderAnnotation != null ? orderAnnotation.value() : 0;
    interceptorToOrder.put(next, order);
  }
  theObjects.sort((a, b) -> {
    Integer orderA = interceptorToOrder.get(a);
    Integer orderB = interceptorToOrder.get(b);
    return orderA - orderB;
  });
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected int getOrder(Object obj) {
  if (obj instanceof Ordered) {
    return ((Ordered) obj).getOrder();
  }
  if (obj != null) {
    Order order = obj.getClass().getAnnotation(Order.class);
    if (order != null) {
      return order.value();
    }
  }
  return Ordered.LOWEST_PRECEDENCE;
}

代码示例来源:origin: org.springframework.security/spring-security-config

private static int lookupOrder(Object obj) {
    if (obj instanceof Ordered) {
      return ((Ordered) obj).getOrder();
    }
    if (obj != null) {
      Class<?> clazz = (obj instanceof Class ? (Class<?>) obj : obj.getClass());
      Order order = AnnotationUtils.findAnnotation(clazz, Order.class);
      if (order != null) {
        return order.value();
      }
    }
    return Ordered.LOWEST_PRECEDENCE;
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private boolean scanInterceptorForHookMethodsAndAddThem(Object theInterceptor, int theTypeOrder) {
  boolean retVal = false;
  for (Method nextMethod : theInterceptor.getClass().getDeclaredMethods()) {
    Hook hook = AnnotationUtils.findAnnotation(nextMethod, Hook.class);
    if (hook != null) {
      int methodOrder = theTypeOrder;
      Order methodOrderAnnotation = AnnotationUtils.findAnnotation(nextMethod, Order.class);
      if (methodOrderAnnotation != null) {
        methodOrder = methodOrderAnnotation.value();
      }
      HookInvoker invoker = new HookInvoker(hook, theInterceptor, nextMethod, methodOrder);
      for (Pointcut nextPointcut : hook.value()) {
        myInvokers.put(nextPointcut, invoker);
      }
      retVal = true;
    }
  }
  return retVal;
}

代码示例来源:origin: de.otto.synapse/synapse-core

private int getOrder(final Method method) {
  final int order;
  Order ann = AnnotationUtils.findAnnotation(method, Order.class);
  if (ann != null) {
    order = ann.value();
  } else {
    order = LOWEST_PRECEDENCE;
  }
  return order;
}

代码示例来源:origin: spring-projects/spring-integration

Order orderAnnotation = AnnotationUtils.findAnnotation(method, Order.class);
if (orderAnnotation != null) {
  ((Orderable) handler).setOrder(orderAnnotation.value());

代码示例来源:origin: net.paoding/paoding-rose-jade

@Override
  public int compare(Interpreter thees, Interpreter that) {
    Order thessOrder = thees.getClass().getAnnotation(Order.class);
    Order thatOrder = that.getClass().getAnnotation(Order.class);
    int thessValue = thessOrder == null ? 0 : thessOrder.value();
    int thatValue = thatOrder == null ? 0 : thatOrder.value();
    return thessValue - thatValue;
  }
}

代码示例来源:origin: com.54chen/paoding-rose-jade

@Override
  public int compare(Interpreter thees, Interpreter that) {
    Order thessOrder = thees.getClass().getAnnotation(Order.class);
    Order thatOrder = that.getClass().getAnnotation(Order.class);
    int thessValue = thessOrder == null ? 0 : thessOrder.value();
    int thatValue = thatOrder == null ? 0 : thatOrder.value();
    return thessValue - thatValue;
  }
}

代码示例来源:origin: stackoverflow.com

public class ComparatorReflection<T extends AccessibleObject & Member> implements Comparator<T>{

  @Override
  public int compare(T o1, T o2) {
    Order or1 = o1.getAnnotation(Order.class); 
    Order or2 = o2.getAnnotation(Order.class); 
    if (or1 != null && or2 != null && or1.value() - or2.value() != 0) {
      return or1.value() - or2.value(); 
    }
    return o1.getName().compareTo(o2.getName()); 
  }

}

代码示例来源:origin: apache/servicemix-bundles

private int resolveOrder(Method method) {
  Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
  return (ann != null ? ann.value() : 0);
}

代码示例来源:origin: org.springframework.security/spring-security-javaconfig

private static int lookupOrder(Object obj) {
    if (obj instanceof Ordered) {
      return ((Ordered) obj).getOrder();
    }
    if (obj != null) {
      Class<?> clazz = (obj instanceof Class ? (Class<?>) obj : obj.getClass());
      Order order = AnnotationUtils.findAnnotation(clazz,Order.class);
      if (order != null) {
        return order.value();
      }
    }
    return Ordered.LOWEST_PRECEDENCE;
  }
}

相关文章