Class Interceptor

java.lang.Object
org.rapidcontext.core.storage.StorableObject
org.rapidcontext.core.type.Interceptor
Direct Known Subclasses:
CallInterceptor, ReserveInterceptor

public class Interceptor extends StorableObject
A system call interceptor. This generic type only provides the basic mechanism of loading and caching an interceptor chain.
  • Field Details

    • KEY_DESCRIPTION

      public static final String KEY_DESCRIPTION
      The dictionary key for the description.
      See Also:
    • KEY_PRIO

      public static final String KEY_PRIO
      The dictionary key for the ordering priority.
      See Also:
    • PATH

      public static final Path PATH
      The interceptor object storage path.
  • Constructor Details

    • Interceptor

      public Interceptor(String id, String type, Dict dict)
      Creates a new interceptor from a serialized representation.
      Parameters:
      id - the object identifier
      type - the object type name
      dict - the serialized representation
  • Method Details

    • init

      public static void init(Storage storage)
      Initializes the interceptor chain cache from the storage. This is intended to be called once during application initialization.
      Parameters:
      storage - the storage to use
    • get

      public static <T extends Interceptor> T get(Class<T> clazz)
      Returns the interceptor chain for a given class.
      Type Parameters:
      T - the interceptor type to return
      Parameters:
      clazz - the interceptor class
      Returns:
      the interceptor chain, or null if no interceptor chain is found
    • description

      public String description()
      Returns the interceptor description.
      Returns:
      the interceptor description.
    • prio

      public int prio()
      Returns the ordering priority.
      Returns:
      the ordering priority
    • next

      public Interceptor next()
      Returns the next interceptor in the chain.
      Returns:
      the next interceptor, or null if no next is available
    • next

      public <T extends Interceptor> T next(Class<T> clazz)
      Returns the next interceptor in the chain.
      Type Parameters:
      T - the interceptor type to return
      Parameters:
      clazz - the interceptor class
      Returns:
      the next interceptor, or null if no next is available
    • setNext

      protected <T extends Interceptor> Interceptor setNext(T next)
      Sets the next interceptor in the chain.
      Type Parameters:
      T - the interceptor type
      Parameters:
      next - the next interceptor
      Returns:
      this interceptor
    • chain

      protected String chain()
      Returns a string representation of the interceptor chain.
      Returns:
      a string representation of the interceptor chain