@ SuppressWarnings ( "unchecked" ) public < C extends Capability > C getCapability ( Class < C > capabilityType ) { if ( capabilityType . isInstance ( this ) ) { return ( C ) this ; } return null ; }
Default implementation checks if Repository implements Capability interface and if so returns the Repository .