Class SimpleRepositoryMethodCustomImplHandler
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.method.handler.SimpleRepositoryMethodCustomImplHandler
- All Implemented Interfaces:
- SimpleRepositoryMethodHandler
public class SimpleRepositoryMethodCustomImplHandler
extends Object
implements SimpleRepositoryMethodHandler
Handler for executing custom methods in a custom repository implementation.
 Implements the 
SimpleRepositoryMethodHandler interface.- Since:
- 1.0
- Author:
- Blyzhnytsia Team
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final StringMessage indicating the failure to invoke a class method with specified parameters.private static final StringMessage indicating that a class method is found and will be invoked with specified parameters.List of custom repository implementations.static final StringMessage indicating that the implementation for a specific method is not resolved.private static final StringMessage indicating an attempt to find a custom repository implementation for a specific method.Fields inherited from interface io.github.blyznytsiaorg.bibernate.dao.method.handler.SimpleRepositoryMethodHandlerCANNOT_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionexecute(Method method, Object[] parameters, RepositoryDetails repositoryDetails, MethodMetadata methodMetadata) Executes the custom method in the custom repository implementation.private static ObjectinvokeMethod(Object[] parameters, Object customRepository, Method customRepositoryMethod) Invokes the specified method on the custom repository implementation with the given parameters.booleanisMethodHandle(Method method) Checks if the given method is handled by any of the custom repository implementations.
- 
Field Details- 
TRY_TO_FIND_OUT_CUSTOM_REPOSITORY_IMPLEMENTATION_FOR_S_METHODMessage indicating an attempt to find a custom repository implementation for a specific method.- See Also:
 
- 
CLASS_METHOD_FOUND_WILL_INVOKE_IT_WITH_PARAMETERSMessage indicating that a class method is found and will be invoked with specified parameters.- See Also:
 
- 
CANNOT_INVOKE_CLASS_METHOD_WITH_PARAMETERS_MESSAGEMessage indicating the failure to invoke a class method with specified parameters.- See Also:
 
- 
IMPLEMENTATION_FOR_METHOD_S_NOT_RESOLVEDMessage indicating that the implementation for a specific method is not resolved.- See Also:
 
- 
customRepositoryImplementationsList of custom repository implementations.
 
- 
- 
Constructor Details- 
SimpleRepositoryMethodCustomImplHandlerpublic SimpleRepositoryMethodCustomImplHandler()
 
- 
- 
Method Details- 
isMethodHandleChecks if the given method is handled by any of the custom repository implementations.- Specified by:
- isMethodHandlein interface- SimpleRepositoryMethodHandler
- Parameters:
- method- The method to check.
- Returns:
- trueif the method is handled,- falseotherwise.
 
- 
executepublic Object execute(Method method, Object[] parameters, RepositoryDetails repositoryDetails, MethodMetadata methodMetadata) Executes the custom method in the custom repository implementation.- Specified by:
- executein interface- SimpleRepositoryMethodHandler
- Parameters:
- method- The 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 custom method execution.
- Throws:
- IllegalArgumentException- If the custom method implementation for the given method is not found.
 
- 
invokeMethodprivate static Object invokeMethod(Object[] parameters, Object customRepository, Method customRepositoryMethod) Invokes the specified method on the custom repository implementation with the given parameters.- Parameters:
- parameters- The parameters for the method invocation.
- customRepository- The custom repository implementation instance.
- customRepositoryMethod- The method to invoke.
- Returns:
- The result of the method invocation.
- Throws:
- BibernateGeneralException- If an error occurs during method invocation.
 
 
-