content: /*
   * Copyright 1999-2020 Alibaba Group Holding Ltd.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package com.alibaba.csp.sentinel.annotation.cdi.interceptor;
  
  import com.alibaba.csp.sentinel.EntryType;
  
  import javax.enterprise.util.Nonbinding;
  import javax.interceptor.InterceptorBinding;
  
  import java.lang.annotation.*;
  
  /**
   * The annotation indicates a definition of Sentinel resource.
   *
   * @author Eric Zhao
   * @author seasidesky
   * @since 1.8.0
   */
  @InterceptorBinding
  @Target({ElementType.METHOD, ElementType.TYPE})
  @Retention(RetentionPolicy.RUNTIME)
  @Inherited
  public @interface SentinelResourceBinding {
  
      /**
       * @return name of the Sentinel resource
       */
      @Nonbinding
      String value() default "";
  
      /**
       * @return the entry type (inbound or outbound), outbound by default
       */
      @Nonbinding
      EntryType entryType() default EntryType.OUT;
  
      /**
       * @return the classification (type) of the resource
       */
      @Nonbinding
      int resourceType() default 0;
  
      /**
       * @return name of the block exception function, empty by default
       */
      @Nonbinding
      String blockHandler() default "";
  
      /**
       * The {@code blockHandler} is located in the same class with the original method by default.
       * However, if some methods share the same signature and intend to set the same block handler,
       * then users can set the class where the block handler exists. Note that the block handler method
       * must be static.
       *
       * @return the class where the block handler exists, should not provide more than one classes
       */
      @Nonbinding
      Class<?>[] blockHandlerClass() default {};
  
      /**
       * @return name of the fallback function, empty by default
       */
      @Nonbinding
      String fallback() default "";
  
      /**
       * The {@code defaultFallback} is used as the default universal fallback method.
       * It should not accept any parameters, and the return type should be compatible
       * with the original method.
       *
       * @return name of the default fallback method, empty by default
       */
      @Nonbinding
      String defaultFallback() default "";
  
      /**
       * The {@code fallback} is located in the same class with the original method by default.
       * However, if some methods share the same signature and intend to set the same fallback,
       * then users can set the class where the fallback function exists. Note that the shared fallback method
       * must be static.
       *
       * @return the class where the fallback method is located (only single class)
       */
      @Nonbinding
      Class<?>[] fallbackClass() default {};
  
      /**
       * @return the list of exception classes to trace, {@link Throwable} by default
       */
      @Nonbinding
      Class<? extends Throwable>[] exceptionsToTrace() default {Throwable.class};
  
      /**
       * Indicates the exceptions to be ignored. Note that {@code exceptionsToTrace} should
       * not appear with {@code exceptionsToIgnore} at the same time, or {@code exceptionsToIgnore}
       * will be of higher precedence.
       *
       * @return the list of exception classes to ignore, empty by default
       */
      @Nonbinding
      Class<? extends Throwable>[] exceptionsToIgnore() default {};
  }
  