Package org.spongepowered.api.service
Interface ServiceProvider
-
- All Known Subinterfaces:
ServiceProvider.GameScoped
,ServiceProvider.ServerScoped
public interface ServiceProvider
Provides various Sponge services.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ServiceProvider.GameScoped
Provides services that are scoped to aServiceProvider.GameScoped
instance.static interface
ServiceProvider.ServerScoped
Provides serivces that are scoped to theServiceProvider.ServerScoped
Engine
only.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> java.util.Optional<T>
provide(java.lang.Class<T> serviceClass)
Provides the service represented by the suppliedClass
.<T> java.util.Optional<ServiceRegistration<T>>
registration(java.lang.Class<T> serviceClass)
Provides theServiceRegistration
for the suppliedClass
.
-
-
-
Method Detail
-
provide
<T> java.util.Optional<T> provide(java.lang.Class<T> serviceClass)
Provides the service represented by the suppliedClass
.- Type Parameters:
T
- The type of service- Parameters:
serviceClass
- The class- Returns:
- The service, if one exists
-
registration
<T> java.util.Optional<ServiceRegistration<T>> registration(java.lang.Class<T> serviceClass)
Provides theServiceRegistration
for the suppliedClass
.- Type Parameters:
T
- The type of service- Parameters:
serviceClass
- The class- Returns:
- The registration, if one exists
-
-