code: @Nullable
      private static DecoratorAndOrder userDefinedDecorator(Annotation annotation) {
          // User-defined decorator MUST be annotated with @DecoratorFactory annotation.
          final DecoratorFactory d =
                  findFirstDeclared(annotation.annotationType(), DecoratorFactory.class).orElse(null);
          if (d == null) {
              return null;
          }
  
          // In case of user-defined decorator, we need to create a new decorator from its factory.
          @SuppressWarnings("unchecked")
          final DecoratorFactoryFunction<Annotation> factory = getInstance(d, DecoratorFactoryFunction.class);
  
          // If the annotation has "order" attribute, we can use it when sorting decorators.
          int order = 0;
          try {
              final Method method = Iterables.getFirst(getMethods(annotation.annotationType(),
                                                                  withName("order")), null);
              if (method != null) {
                  final Object value = method.invoke(annotation);
                  if (value instanceof Integer) {
                      order = (Integer) value;
                  }
              }
          } catch (Throwable ignore) {
              // A user-defined decorator may not have an 'order' attribute.
              // If it does not exist, '0' is used by default.
          }
          return new DecoratorAndOrder(annotation, factory.newDecorator(annotation), order);
      }
docs: Returns a decorator with its order if the specified {@code annotation} is one of the user-defined
  decorator annotation.