/** * Returns the first underlying registry that is an instance of {@code c}. */ @SuppressWarnings("unchecked") default <T extends Registry> T underlying(Class<T> c) { if (c.isAssignableFrom(getClass())) { return (T) this; } else if (this instanceof CompositeRegistry) { return ((CompositeRegistry) this).find(c); } else { return null; } }
/** * Returns the first underlying registry that is an instance of {@code c}. */ @SuppressWarnings("unchecked") default <T extends Registry> T underlying(Class<T> c) { if (c.isAssignableFrom(getClass())) { return (T) this; } else if (this instanceof CompositeRegistry) { return ((CompositeRegistry) this).find(c); } else { return null; } }