Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Checks if the handler can handle the given type, and if so, returns an
- * instance for handling it. This is ony used for handlers that are registered
- * with the {@link Registry}.
- *
- * @param type
- * A type that wants to be handled
- * @return An {@link IHandler} to handle the given type, if possible. <code>null</code otherwise.
- */
- default IHandler<? extends T> getHandler(Type type) {
- return isAssignable(getRootType(), type) ? this : null;
- }
- /**
- * Utility method for simple handlers that handle a single class. Only used by
- * {@link #getHandler(Type)}.
- *
- * @return The {@link #getClass()} this handler can handle.
- */
- default Class<?> getRootType() {
- // Should be equivalent to null without being null. Nothing can extend, nor would use Void.
- return Void.class;
- }
Advertisement
Add Comment
Please, Sign In to add comment