@SuppressWarnings("unchecked")
   public static <T> T lookup(Class<T> type)
   {
      if (instanceProviders == null) {
         instanceProviders = Iterators.asList(ServiceLoader.load(InstanceProvider.class));
         Collections.sort(instanceProviders, new WeightedComparator());
         ServiceLogger.logLoadedServices(log, InstanceProvider.class, instanceProviders);
      }

      T result = null;
      for (InstanceProvider p : instanceProviders) {
         result = (T) p.getInstance(type);
         if (result != null)
         {
            break;
         }
      }
      return result;
   }
@SuppressWarnings("unchecked")
   public static <T> T lookup(Class<T> type)
   {
      if (instanceProviders == null) {
         instanceProviders = Iterators.asList(ServiceLoader.load(InstanceProvider.class));
         Collections.sort(instanceProviders, new WeightedComparator());
         ServiceLogger.logLoadedServices(log, InstanceProvider.class, instanceProviders);
      }

      T result = null;
      for (InstanceProvider p : instanceProviders) {
         result = (T) p.getInstance(type);
         if (result != null)
         {
            break;
         }
      }
      return result;
   }
@ SuppressWarnings ( "unchecked" ) public static < T > T lookup ( Class < T > type ) { if ( instanceProviders == null ) { instanceProviders = Iterators . asList ( ServiceLoader . load ( InstanceProvider . class ) ) ; Collections . sort ( instanceProviders , new WeightedComparator ( ) ) ; ServiceLogger . logLoadedServices ( log , InstanceProvider . class , instanceProviders ) ; } T result = null ; for ( InstanceProvider p : instanceProviders ) { result = ( T ) p . getInstance ( type ) ; if ( result != null ) { break ; } } return result ; }
Lookup an instance of the given {@link Class} type.
Lookup an instance of the given {