@ SuppressWarnings ( "unchecked" ) public static < S extends ArtifactCollector < ? extends ArtifactType > > Optional < S > getWatcher ( Description description , Class < S > watcherType ) { List < ArtifactCollector < ? extends ArtifactType > > watcherList = watcherMap . get ( description ) ; if ( watcherList != null ) { for ( ArtifactCollector < ? extends ArtifactType > watcher : watcherList ) { if ( watcher . getClass ( ) == watcherType ) { return Optional . of ( ( S ) watcher ) ; } } } return Optional . absent ( ) ; }
Get reference to an instance of the specified watcher type associated with the described method .