Package org.rapidcontext.core.type
Class Interceptor
java.lang.Object
org.rapidcontext.core.storage.StorableObject
org.rapidcontext.core.type.Interceptor
- Direct Known Subclasses:
CallInterceptor,ReserveInterceptor
A system call interceptor. This generic type only provides the basic
mechanism of loading and caching an interceptor chain.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe dictionary key for the description.static final StringThe dictionary key for the ordering priority.static final PathThe interceptor object storage path.Fields inherited from class org.rapidcontext.core.storage.StorableObject
dict, KEY_ACTIVATED_TIME, KEY_CLASSNAME, KEY_ID, KEY_TYPE, PREFIX_COMPUTED, PREFIX_HIDDEN -
Constructor Summary
ConstructorsConstructorDescriptionInterceptor(String id, String type, Dict dict) Creates a new interceptor from a serialized representation. -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringchain()Returns a string representation of the interceptor chain.Returns the interceptor description.static <T extends Interceptor>
TReturns the interceptor chain for a given class.static voidInitializes the interceptor chain cache from the storage.next()Returns the next interceptor in the chain.<T extends Interceptor>
TReturns the next interceptor in the chain.intprio()Returns the ordering priority.protected <T extends Interceptor>
InterceptorsetNext(T next) Sets the next interceptor in the chain.
-
Field Details
-
KEY_DESCRIPTION
The dictionary key for the description.- See Also:
-
KEY_PRIO
The dictionary key for the ordering priority.- See Also:
-
PATH
The interceptor object storage path.
-
-
Constructor Details
-
Interceptor
Creates a new interceptor from a serialized representation.- Parameters:
id- the object identifiertype- the object type namedict- the serialized representation
-
-
Method Details
-
init
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
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
Returns the interceptor description.- Returns:
- the interceptor description.
-
prio
public int prio()Returns the ordering priority.- Returns:
- the ordering priority
-
next
Returns the next interceptor in the chain.- Returns:
- the next interceptor, or null if no next is available
-
next
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
Sets the next interceptor in the chain.- Type Parameters:
T- the interceptor type- Parameters:
next- the next interceptor- Returns:
- this interceptor
-
chain
Returns a string representation of the interceptor chain.- Returns:
- a string representation of the interceptor chain
-