Class SimpleRepositoryInvocationHandler
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.SimpleRepositoryInvocationHandler
- All Implemented Interfaces:
InvocationHandler
InvocationHandler implementation for dynamically handling method invocations on repository interfaces.
It delegates the invocation to a SimpleRepositoryFactory for handling repository-specific operations.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
Modifier and TypeFieldDescriptionprivate final SimpleRepositoryFactory
The SimpleRepositoryFactory used for handling repository-specific operations. -
Constructor Summary
ConstructorDescriptionConstructs a SimpleRepositoryInvocationHandler with a new instance of SimpleRepositoryFactory. -
Method Summary
Modifier and TypeMethodDescriptionHandles the method invocation by delegating it to the associated SimpleRepositoryFactory.<T> T
registerRepository
(Class<T> repositoryInterface) Registers a repository interface and creates a dynamic proxy for it.
-
Field Details
-
simpleRepositoryFactory
The SimpleRepositoryFactory used for handling repository-specific operations.
-
-
Constructor Details
-
SimpleRepositoryInvocationHandler
public SimpleRepositoryInvocationHandler()Constructs a SimpleRepositoryInvocationHandler with a new instance of SimpleRepositoryFactory.
-
-
Method Details
-
invoke
Handles the method invocation by delegating it to the associated SimpleRepositoryFactory.- Specified by:
invoke
in interfaceInvocationHandler
- Parameters:
proxy
- The proxy object.method
- The method being invoked.parameters
- The parameters for the method invocation.- Returns:
- The result of the method invocation.
-
registerRepository
Registers a repository interface and creates a dynamic proxy for it.- Type Parameters:
T
- The type of the repository interface.- Parameters:
repositoryInterface
- The repository interface to be registered.- Returns:
- A dynamic proxy instance for the registered repository interface.
-