public <S> S get(Class<S> service)
    {
        Check.notNull(service);
        for (final Object object : servicesSet)
        {
            if (service.isAssignableFrom(object.getClass()))
            {
                return service.cast(object);
            }
        }
        if (service == getClass())
        {
            return service.cast(this);
        }
        throw new LionEngineException(ERROR_SERVICE_GET + service.getName());
    }
public < S > S get ( Class < S > service ) { Check . notNull ( service ) ; for ( final Object object : servicesSet ) { if ( service . isAssignableFrom ( object . getClass ( ) ) ) { return service . cast ( object ) ; } } if ( service == getClass ( ) ) { return service . cast ( this ) ; } throw new LionEngineException ( ERROR_SERVICE_GET + service . getName ( ) ) ; }
Get a service from its class.
<p>
The first instance (previously added with {@link #add(Object)} or {@link #create(Class)}) which fit the required
type is returned.
</p>

<pre>
final Services services = new Services();
services.add(new Camera());
...
final Viewer viewer = services.get(Viewer.class) // Get the camera as viewer
</pre>

@param <S> The service type.
@param service The service type.
@return The service implementation found.
@throws LionEngineException If service not found or <code>null</code>.