Launch the navigation by type

@param service interface of service
@param <T>     return type
@return instance of service
359296
public <T> T navigation(Class<? extends T> service) {
        return _ARouter.getInstance().navigation(service);
    }
539912
protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
  {
    if( !_definingServices )
    {
      throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
    }
    if( !service.isInterface() )
    {
      throw new IllegalArgumentException( "Services may only be defined as interfaces, and " +
                                          service.getName() +
                                          " is not an interface" );
    }
    IService existingServiceImpl = _services.get( service );
    if( existingServiceImpl != null )
    {
      throw new IllegalStateException( "Service " + service.getName() + " has already been " +
                                       "defined with the " + existingServiceImpl.getClass().getName() +
                                       " default implementation");
    }
    _services.put( service, defaultImplementation );
  }
809822
private <T extends OrchidService> void initializeService(Class<T> serviceClass, T service) {
        services.put(serviceClass, service);
    }
571929
public Object startupService(BundleContext bundleContext)
    {
        // Good, Environment activator is up. Time to start up http services trackers
        
        for (String alias : getAliases())
        {
            Dictionary<String, String> properties = new Hashtable<String, String>();
            ServiceTracker serviceTracker = this.makeServletTracker(alias, properties);
            ((ServiceTracker)serviceTracker).open();
            context.registerService(ServiceTracker.class.getName(), serviceTracker, properties);    // Why isn't this done automatically?
        }

        return null;
    }
692678
public static <T> T getService(BundleContext bundleContext, Class<T> serviceClass) {
        T service = null;
        if (FrameworkState.isValid()) {
            ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass);

            if (ref != null) {
                service = bundleContext.getService(ref);
            }
        }
        return service;
    }
472386
public CacheManagerBuilder<T> using(Service service) {
    Set<Service> newServices = new HashSet<>(services);
    newServices.add(service);
    return new CacheManagerBuilder<>(this, newServices);
  }
17579
def find_service_by_type(self, service_type):
        
        for service in self._services:
            if service_type == service.type:
                return service
        return None
782646
public ServiceInstance<T> build()
    {
        return new ServiceInstance<T>(name, id, address, port, sslPort, payload, registrationTimeUTC, serviceType, uriSpec, enabled);
    }
1256903
public static <T> T getService(Class<T> serviceType) {
        List<T> services = getServiceProvider().getServices(serviceType);
		return services
				.stream()
                .findFirst()
                .orElse(null);
    }
606938
public static <T> ServiceController<T> findService(ServiceRegistry registry, ServiceName name) {
        return (ServiceController<T>) registry.getService(name);
    }
953764
@SneakyThrows
    @SuppressWarnings("unchecked")
    public static <T> Collection<T> newServiceInstances(final Class<T> service) {
        Collection<T> result = new LinkedList<>();
        if (null == SERVICE_MAP.get(service)) {
            return result;
        }
        for (Class<?> each : SERVICE_MAP.get(service)) {
            result.add((T) each.newInstance());
        }
        return result;
    }
305847
private RaftServiceContext getOrInitializeService(PrimitiveId primitiveId, PrimitiveType primitiveType, String serviceName, byte[] config) {
    // Get the state machine executor or create one if it doesn't already exist.
    RaftServiceContext service = raft.getServices().getService(serviceName);
    if (service == null) {
      service = initializeService(primitiveId, primitiveType, serviceName, config);
    }
    return service;
  }
1350977
function startService() {
  let me = this;
  return server.start(me, function(err) {
    if (err) {
      return out.error("service failed to start: %j", err);
    }
    return server.ping(me, function() {
      out.success("service started");
    });
  });
}
955135
@SuppressWarnings("unchecked")
    public static <T> T getService(Class<T> type) {
        Bundle serviceBundle = FrameworkUtil.getBundle(type);
        BundleContext serviceBundleContext = serviceBundle.getBundleContext();
        ServiceReference serviceReference = serviceBundleContext.getServiceReference(type.getName());
        return (T) serviceBundleContext.getService(serviceReference);
    }
399296
public static <I extends Request, O extends Response>
    CompositeServiceEntry<I, O> ofCatchAll(Service<I, O> service) {
        return new CompositeServiceEntry<>(PathMapping.ofCatchAll(), service);
    }
1182913
public static void invokeServiceAdded(ServiceConfig cfg, Service<?, ?> service) {
        requireNonNull(cfg, "cfg");
        requireNonNull(service, "service");

        try {
            service.serviceAdded(cfg);
        } catch (Exception e) {
            throw new IllegalStateException(
                    "failed to invoke serviceAdded() on: " + service, e);
        }
    }
652282
public ServiceCall router(Class<? extends Router> routerType) {
    ServiceCall target = new ServiceCall(this);
    target.router = Routers.getRouter(routerType);
    return target;
  }