Class GenericsUtils
- java.lang.Object
-
- org.springframework.cloud.stream.reflection.GenericsUtils
-
public final class GenericsUtils extends Object
Internal utilities for handling generics.- Author:
- Marius Bogoevici, Gary Russell
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkCompatiblePollableBinder(Binder binderInstance, Class<?> bindingTargetType)
Return the generic type of PollableSource to determine if it is appropriate for the binder.static Class<?>
getParameterType(Class<?> evaluatedClass, Class<?> interfaceClass, int position)
For a specific class that implements or extends a parameterized type, return the parameter of that interface at a given position.
-
-
-
Method Detail
-
getParameterType
public static Class<?> getParameterType(Class<?> evaluatedClass, Class<?> interfaceClass, int position)
For a specific class that implements or extends a parameterized type, return the parameter of that interface at a given position. For example, for this class:class MessageChannelBinder implements Binder<MessageChannel, ?, ?>
getParameterType(MessageChannelBinder.class, Binder.class, 0);
Binder
- Parameters:
evaluatedClass
- the evaluated classinterfaceClass
- the parametrized interfaceposition
- the position- Returns:
- the parameter type if any
- Throws:
IllegalStateException
- if the evaluated class does not implement the interface or
-
checkCompatiblePollableBinder
public static boolean checkCompatiblePollableBinder(Binder binderInstance, Class<?> bindingTargetType)
Return the generic type of PollableSource to determine if it is appropriate for the binder. e.g., with PollableMessageSource extends PollableSource<MessageHandler> and AbstractMessageChannelBinder implements PollableConsumerBinder<MessageHandler, C> We're checking that the the generic type (MessageHandler) matches.- Parameters:
binderInstance
- the binder.bindingTargetType
- the binding target type.- Returns:
- true if found, false otherwise.
-
-