jodd.petite.scope
Interface Scope

All Known Implementing Classes:
DefaultScope, ProtoScope, SessionScope, SingletonScope, ThreadLocalScope

public interface Scope

Petite 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
 boolean accept(Scope referenceScope)
          Returns true if a bean of referenced scope can be injected into target bean of this scope.
 Object lookup(String name)
          Lookups for bean name.
 void register(String name, Object bean)
          Registers the bean within the current scope.
 void remove(String name)
          Removes the bean from the scope entirely.
 

Method Detail

lookup

Object lookup(String name)
Lookups for bean name. It may happens that lookup is performed before the registration, therefore it should returns null if object is not yet registered.


register

void register(String name,
              Object bean)
Registers the bean within the current scope.


remove

void remove(String name)
Removes the bean from the scope entirely.


accept

boolean accept(Scope referenceScope)
Returns true if a bean of referenced scope can be injected into target bean of this scope. Otherwise, returns false, 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.