public class IoC extends Object
A Inversion of Control class.
It is responsible for registering services, resolving services and administrating default query constraints.
| Constructor | Description |
|---|---|
IoC() |
| Modifier and Type | Method | Description |
|---|---|---|
static <T extends BaseEntity> |
addDefaultConstraint(Class<T> clazz,
SqlPredicate<T> predicate) |
|
static SqlPredicate<? extends BaseEntity> |
getConstraints(Class<? extends BaseEntity> tClass) |
|
static <T extends BaseEntity,K extends BaseService<T>> |
registerService(Class<T> clazz,
K service) |
Registers an instance of a service class.
|
static <T> T |
resolve(Class<T> clazz) |
Resolves any class.
|
static <T extends BaseService> |
resolveService(Class<T> clazz) |
Resolves a service class.
|
static BaseService<?> |
resolveServiceByEntity(Class<? extends BaseEntity> clazz) |
Resolves a service class by the entity it was registered with.
|
public static <T> T resolve(Class<T> clazz)
T - The type of the class.clazz - The class to be constructed.IllegalArgumentException - if the class cannot be constructed for any reason.
This can occur if there is no public parameterless constructor available.public static <T extends BaseService> T resolveService(Class<T> clazz)
T - The type of the service class.clazz - The service class to retrieve.public static BaseService<?> resolveServiceByEntity(Class<? extends BaseEntity> clazz)
clazz - The entity class corresponding to a service class.public static <T extends BaseEntity,K extends BaseService<T>> void registerService(Class<T> clazz, K service)
T - The type of the entity.K - The type of the service class.clazz - An entity class.service - The service class this entity corresponds to.public static <T extends BaseEntity> void addDefaultConstraint(Class<T> clazz, SqlPredicate<T> predicate)
public static SqlPredicate<? extends BaseEntity> getConstraints(Class<? extends BaseEntity> tClass)
Copyright © 2018. All rights reserved.