Package jodd.petite.scope
Interface Scope
-
- All Known Implementing Classes:
ProtoScope,ShutdownAwareScope,SingletonScope,ThreadLocalScope
public interface ScopePetite container bean scope. Scopes actually represents wrapper over none, one or many internal bean pools. Which pool is used depends on scopes behaviour and external data.Scopes are instantiated once on their first usage and stored within one container.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaccept(Scope referenceScope)Returnstrueif a bean of referenced scope can be injected into target bean of this scope.java.lang.Objectlookup(java.lang.String name)Lookups for bean name.voidregister(BeanDefinition beanDefinition, java.lang.Object bean)Registers the bean within the current scope.voidremove(java.lang.String name)Removes the bean from the scope entirely.voidshutdown()Shutdowns the scope by removing all beans and calling destroy methods.
-
-
-
Method Detail
-
lookup
java.lang.Object lookup(java.lang.String name)
Lookups for bean name. Returnsnullif bean is not found or yet registered.
-
register
void register(BeanDefinition beanDefinition, java.lang.Object bean)
Registers the bean within the current scope. Usually registers it by its name fromBeanDefinition. Also it may register destroy methods of a bean within this scope.
-
remove
void remove(java.lang.String name)
Removes the bean from the scope entirely. Destroy methods are not called as it is assumed that bean is destroyed manually.
-
accept
boolean accept(Scope referenceScope)
Returnstrueif a bean of referenced scope can be injected into target bean of this scope. Otherwise, returnsfalse, which may be a sign for scoped proxy to be injected.In general, injection of 'shorter' reference scopes into the 'longer' target scopes should not be accepted. In other words, if reference scope is 'longer' or equal (same), this method should return
true.Helpful is to ask the following question: "May the reference scope bean be injected into bean of this scope?".
-
shutdown
void shutdown()
Shutdowns the scope by removing all beans and calling destroy methods.
-
-