
org.revenj.extensibility.Container Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of revenj-core Show documentation
Show all versions of revenj-core Show documentation
DSL Platform compatible backend (https://dsl-platform.com)
The newest version!
package org.revenj.extensibility;
import org.revenj.patterns.ServiceLocator;
import java.lang.reflect.Type;
import java.util.function.BiFunction;
import java.util.function.Function;
public interface Container extends ServiceLocator, AutoCloseable {
@Deprecated
default void registerClass(Type type, Class> manifest, boolean singleton) {
registerType(type, manifest, singleton ? InstanceScope.SINGLETON : InstanceScope.TRANSIENT);
}
void registerType(Type type, Class> manifest, InstanceScope scope);
void registerInstance(Type type, Object service, boolean handleClose);
@Deprecated
default void registerFactory(Type type, Function factory, boolean singleton) {
registerFactory(type, factory, singleton ? InstanceScope.SINGLETON : InstanceScope.CONTEXT);
}
@Deprecated
default void registerFactory(Type type, Function factory) {
registerFactory(type, factory, InstanceScope.TRANSIENT);
}
void registerFactory(Type type, Function factory, InstanceScope scope);
default void registerFactory(Class manifest, Function factory, InstanceScope scope) {
registerFactory((Type)manifest, factory, scope);
}
void registerGenerics(Class manifest, BiFunction factory, InstanceScope scope);
@Deprecated
default void register(Class manifest, boolean singleton) {
registerType(manifest, manifest, singleton ? InstanceScope.SINGLETON : InstanceScope.TRANSIENT);
}
default void register(Class manifest, InstanceScope scope) {
registerType(manifest, manifest, scope);
}
default void register(Class manifest, Class>... manifests) {
registerType(manifest, manifest, InstanceScope.TRANSIENT);
for (Class> it : manifests) {
registerType(it, it, InstanceScope.TRANSIENT);
}
}
@Deprecated
default void registerAs(
Class manifest,
Class as,
boolean singleton) {
registerAs(manifest, as, singleton ? InstanceScope.SINGLETON : InstanceScope.TRANSIENT);
}
default void registerAs(
Class manifest,
Class as,
InstanceScope scope) {
registerType(as, manifest, scope);
}
default void registerInstance(T service) {
registerInstance(service.getClass(), service, service instanceof AutoCloseable);
}
default void registerAs(TService service, Class as) {
registerInstance(as, service, service instanceof AutoCloseable);
}
default void register(Class manifest, Function service) {
registerFactory(manifest, service, InstanceScope.TRANSIENT);
}
Container createScope();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy