jodd.petite.scope
Class DefaultScope

java.lang.Object
  extended by jodd.petite.scope.DefaultScope
All Implemented Interfaces:
Scope

public final class DefaultScope
extends Object
implements Scope

Default Petite container scope. It serves only as a marker for marking the default container scope.


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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lookup

public Object lookup(String name)
Description copied from interface: Scope
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.

Specified by:
lookup in interface Scope

register

public void register(String name,
                     Object bean)
Description copied from interface: Scope
Registers the bean within the current scope.

Specified by:
register in interface Scope

remove

public void remove(String name)
Description copied from interface: Scope
Removes the bean from the scope entirely.

Specified by:
remove in interface Scope

accept

public boolean accept(Scope referenceScope)
Description copied from interface: Scope
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.

Specified by:
accept in interface Scope