Returns the interface class that this adaptor was registered with.
WARNING: This should NOT return either concrete implementation class!
When Pico needs to satisfy a dependency but the class it is asked for is not registered, it reacts by asking
every component adaptor that is registered what its concrete implementation class is. The
thinking is that maybe, just maybe, it can find something registered under a different key that can satisfy
This is the method that Pico uses to do that, and what it's trying to figure out is "When I ask you for your
component instance, of what class will it be?" Previously, this method returned the specific implementation
class that it would delegate to right now, but there are two major problems with doing that:
- If by some strange coincidence the class we return accidentally does satisfy the missing dependency,
then Pico will expect a call to
getComponentInstance(PicoContainer) to yield an object of
that class. However, what we actually return is a dynamic proxy for our own registration interface,
not either of the concrete implementations. Our own registration interface cannot be the desired one
or Pico would have resolved it to us without asking this question in the first place, so this would
- The act of determining the concrete implementation will probably access other components, most likely
application properties and the caching property set that backs them. If they also haven't been resolved yet,
then the result is likely to be infinite recursion leading to a
StackOverflowError instead of gracefully
reporting the unsatisfiable dependency. This makes the problem harder to diagnose and fix, so let's not do
The most accurate answer here would be to return the actual dynamic proxy class we will use, but returning the
interface we registered under is simpler, still honest, and should be good enough.