Class SimpleRepositoryFindByIdMethodHandler
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.method.handler.SimpleRepositoryFindByIdMethodHandler
- All Implemented Interfaces:
SimpleRepositoryMethodHandler
public class SimpleRepositoryFindByIdMethodHandler
extends Object
implements SimpleRepositoryMethodHandler
Handler for executing the "findById" method in a simple repository.
Implements the
SimpleRepositoryMethodHandler
interface.- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
Fields inherited from interface io.github.blyznytsiaorg.bibernate.dao.method.handler.SimpleRepositoryMethodHandler
CANNOT_FIND_RESULT_FOR_S_IN_METHOD_S, CANNOT_RETURN_S_SHOULD_BE_OPTIONAL_S_OR_S, EXPECTED_SINGLE_RESULT, HANDLE_METHOD, LOOKS_LIKE_METHOD_WITHOUT_REQUIRED_PARAMETER_ID, NOT_SUPPORTED_RETURN_TYPE_FOR_METHOD_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(Method method, Object[] parameters, RepositoryDetails repositoryDetails, MethodMetadata methodMetadata) Executes the "findById" method, querying the entity by its primary key.boolean
isMethodHandle
(Method method) Checks if the given method is the "findById" method.
-
Field Details
-
METHOD_NAME
The name of the handled method.- See Also:
-
-
Constructor Details
-
SimpleRepositoryFindByIdMethodHandler
public SimpleRepositoryFindByIdMethodHandler()
-
-
Method Details
-
isMethodHandle
Checks if the given method is the "findById" method.- Specified by:
isMethodHandle
in interfaceSimpleRepositoryMethodHandler
- Parameters:
method
- The method to check.- Returns:
true
if the method is "findById",false
otherwise.
-
execute
public Object execute(Method method, Object[] parameters, RepositoryDetails repositoryDetails, MethodMetadata methodMetadata) Executes the "findById" method, querying the entity by its primary key.- Specified by:
execute
in interfaceSimpleRepositoryMethodHandler
- Parameters:
method
- The "findById" method to execute.parameters
- The parameters for the method invocation.repositoryDetails
- Details about the repository, including its name, primary key type, entity type, etc.methodMetadata
- Metadata for the repository method, including its name, return type, and parameters.- Returns:
- The result of the "findById" method execution.
- Throws:
IllegalArgumentException
- If the method parameters are not as expected.
-