JUtils
A unity utilities library
JUtils.ServiceManager Class Reference

A simple service manager More...

Inheritance diagram for JUtils.ServiceManager:
Collaboration diagram for JUtils.ServiceManager:

Static Public Member Functions

static bool Exists< T > ()
 Check if a service exists More...
 
static bool Exists (Type serviceType)
 Check if a service exists More...
 
static T Get< T > ()
 Get the instance of the given service More...
 
static IService Get (Type serviceType)
 Get the instance of the given service More...
 
static void Register (Type serviceType, IService service)
 Register a new service and initialize it. Will throw if it already exists. More...
 
static void Remove< T > ()
 Remove an existing service and dispose it More...
 
static void Remove (Type type)
 Remove an existing service and dispose it More...
 

Additional Inherited Members

- Protected Member Functions inherited from JUtils.AutoSingletonBehaviour< ServiceManager >
virtual void Awake ()
 
virtual void OnDestroy ()
 
- Properties inherited from JUtils.AutoSingletonBehaviour< ServiceManager >
static T instance [get]
 
static bool exists [get]
 

Detailed Description

A simple service manager

Member Function Documentation

◆ Exists()

static bool JUtils.ServiceManager.Exists ( Type  serviceType)
inlinestatic

Check if a service exists

References JUtils.AutoSingletonBehaviour< ServiceManager >.instance.

◆ Exists< T >()

static bool JUtils.ServiceManager.Exists< T > ( )
inlinestatic

Check if a service exists

Type Constraints
T :IService 

References JUtils.AutoSingletonBehaviour< ServiceManager >.instance.

◆ Get()

static IService JUtils.ServiceManager.Get ( Type  serviceType)
inlinestatic

Get the instance of the given service

References JUtils.AutoSingletonBehaviour< ServiceManager >.instance.

Here is the caller graph for this function:

◆ Get< T >()

static T JUtils.ServiceManager.Get< T > ( )
inlinestatic

Get the instance of the given service

Type Constraints
T :IService 

References JUtils.ServiceManager.Get().

Here is the call graph for this function:

◆ Register()

static void JUtils.ServiceManager.Register ( Type  serviceType,
IService  service 
)
inlinestatic

Register a new service and initialize it. Will throw if it already exists.

References JUtils.AssemblyJUtils.ExtendsClassOrInterface(), JUtils.IService.Init(), and JUtils.AutoSingletonBehaviour< ServiceManager >.instance.

Here is the call graph for this function:

◆ Remove()

static void JUtils.ServiceManager.Remove ( Type  type)
inlinestatic

Remove an existing service and dispose it

References JUtils.IService.Dispose(), JUtils.ServiceManager.Get(), and JUtils.AutoSingletonBehaviour< ServiceManager >.instance.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Remove< T >()

static void JUtils.ServiceManager.Remove< T > ( )
inlinestatic

Remove an existing service and dispose it

Type Constraints
T :IService 

References JUtils.ServiceManager.Remove().

Here is the call graph for this function:

The documentation for this class was generated from the following file: