Class BeanCreateMethodFinder<T>
- Type Parameters:
- T- The bean type being created.
Used for finding and invoking methods on an object that take in arbitrary parameters and returns bean instances.
This class is instantiated through the following methods:
Example:
   
See Also:
- 
Method SummaryModifier and TypeMethodDescription<T2> BeanCreateMethodFinder<T>Adds a bean to the lookup for parameters.Shortcut for callingfind( .x ->x .hasName(methodName ))find(Predicate<MethodInfo> filter) Find the method matching the specified predicate.run()Executes the matched method and returns the result.Same asrun()but also executes a consumer if the returned value was notnull .Identical tofind(Predicate)but named for fluent-style calls.thenFind(Predicate<MethodInfo> filter) Identical tofind(Predicate)but named for fluent-style calls.withDefault(Supplier<T> def) A default value to return if no matching methods were found.withDefault(T def) A default value to return if no matching methods were found.
- 
Method Details- 
addBeanAdds a bean to the lookup for parameters.- Type Parameters:
- T2- The bean type.
- Parameters:
- c- The bean type.
- t- The bean.
- Returns:
- This object.
 
- 
findFind the method matching the specified predicate.In order for the method to be used, it must adhere to the following restrictions: - The method must be public.
- The method can be static.
- The method name must match exactly.
- The method must not be deprecated or annotated with BeanIgnore.
- The method must have all parameter types specified in requiredParams .
- The bean store must contain beans for all parameter types.
- The bean store may contain beans for all Optionalparameter types.
 This method can be called multiple times with different method names or required parameters until a match is found. 
 Once a method is found, subsequent calls to this method will be no-ops. SeeBeanStore.createMethodFinder(Class, Object)for usage.- Parameters:
- filter- The predicate to apply.
- Returns:
- This object.
 
- 
findShortcut for callingfind( .x ->x .hasName(methodName ))- Parameters:
- methodName- The method name to match.
- Returns:
- This object.
 
- 
thenFindIdentical tofind(Predicate)but named for fluent-style calls.- Parameters:
- filter- The predicate to apply.
- Returns:
- This object.
 
- 
thenFindIdentical tofind(Predicate)but named for fluent-style calls.- Parameters:
- methodName- The method name to match.
- Returns:
- This object.
 
- 
withDefaultA default value to return if no matching methods were found.- Parameters:
- def- The default value. Can be- null .
- Returns:
- This object.
 
- 
withDefaultA default value to return if no matching methods were found.- Parameters:
- def- The default value.
- Returns:
- This object.
 
- 
runExecutes the matched method and returns the result.- Returns:
- The object returned by the method invocation, or the default value if method was not found.
- Throws:
- ExecutableException- If method invocation threw an exception.
 
- 
runSame asrun()but also executes a consumer if the returned value was notnull .- Parameters:
- consumer- The consumer of the response.
- Returns:
- The object returned by the method invocation, or the default value if method was not found, or Optional.empty().
- Throws:
- ExecutableException- If method invocation threw an exception.
 
 
-