net.sf.navel.beans
Class DefaultConstructor

java.lang.Object
  extended by net.sf.navel.beans.DefaultConstructor
All Implemented Interfaces:
ConstructionDelegate

public class DefaultConstructor
extends java.lang.Object
implements ConstructionDelegate

Does nothing, a Null Pattern so that there is a useable but no-op delegate to call for all proxies created.

Author:
cmdln

Field Summary
static ConstructionDelegate CONSTRUCTOR
           
 
Method Summary
 java.util.Collection<java.lang.Class<?>> additionalTypes(int nestingDepth, java.lang.Class<?> thisType, java.lang.Class<?> primaryType, java.lang.Class<?>[] allTypes, java.util.Map<java.lang.String,java.lang.Object> initialValues)
          Give callers a chance to hook into the ProxyFactory for purposes of conditionally augmenting the interfaces any given dynamic proxy will implement based on information made available declaratively through the create call.
 void initBehaviors(int nestingDepth, java.lang.Class<?> thisType, java.lang.Object bean)
          This code will get invoked any any new Navel been that implements the type for which this instance is registered immediately after the Proxy is created but before the reference is returned out of ProxyFactory making this suitable to do custom "construction" work.
 void initValues(int nestingDepth, java.lang.Class<?> thisType, java.lang.Object bean)
          This code will get invoked any any new Navel bean that implements the type for which this instance is registered immediately after the Proxy is created but before the reference is returned out of ProxyFactory making this suitable to do custom "construction" work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCTOR

public static final ConstructionDelegate CONSTRUCTOR
Method Detail

additionalTypes

public java.util.Collection<java.lang.Class<?>> additionalTypes(int nestingDepth,
                                                                java.lang.Class<?> thisType,
                                                                java.lang.Class<?> primaryType,
                                                                java.lang.Class<?>[] allTypes,
                                                                java.util.Map<java.lang.String,java.lang.Object> initialValues)
Description copied from interface: ConstructionDelegate
Give callers a chance to hook into the ProxyFactory for purposes of conditionally augmenting the interfaces any given dynamic proxy will implement based on information made available declaratively through the create call. Any kind of copy on ProxyFactory, including those that produce unmodifiable beans, will bypass this method on construction as the contract of copy is to preserve exactly the typing of the source.

Specified by:
additionalTypes in interface ConstructionDelegate
Parameters:
nestingDepth - For directly or indirectly recursive relationships between types, this argument lets the delegate consider nesting depth as part of its criteria as to whether it should do anything special.
thisType - This is the type that triggered the call into the delegate, specifically.
primaryType - The primary type for the Proxy about to be created, may or may not match the thisType argument.
allTypes - All of the original types requested, in case the code that initially invoked create already included an interface of interest.
initialValues - May be empty, will never be null; allows type augmentation based on the initial values for a new JavaBeanHandler. The value based in will be immutable as this method is not meant to alter the state of the bean under construction.
Returns:
Any additional interfaces that the Proxy should implement or null if no additional interfaces should be added. Any duplicates from other ConstructionDelegate instances invoked before Proxy creation will be eliminated.
See Also:
ConstructionDelegate.additionalTypes(int, java.lang.Class, java.lang.Class, java.lang.Class[], java.util.Map)

initValues

public void initValues(int nestingDepth,
                       java.lang.Class<?> thisType,
                       java.lang.Object bean)
Description copied from interface: ConstructionDelegate
This code will get invoked any any new Navel bean that implements the type for which this instance is registered immediately after the Proxy is created but before the reference is returned out of ProxyFactory making this suitable to do custom "construction" work. The implementer should take care of both direct value initialization on the bean argument and attachment of any stock PropertyDelegate instances, as these are both germane to the initial observable state of the object under construction. This code will not get invoked during a copy of any kind, this includes ProxyFactory.unmodifiableObject(Object) and ProxyFactory.unmodifiableObjectAs(Class, Object). Copy operations will perform a shallow copy of the source's already attached PropertyDelegate instances, so copies will carry forward synthetic properties consistent with their sources and should prevent any issues with copy bypassing the call into this method.

Specified by:
initValues in interface ConstructionDelegate
Parameters:
nestingDepth - For directly or indirectly recursive relationships between types, this argument lets the delegate consider nesting depth as part of its criteria as to whether it should do anything special.
thisType - This is the type that triggered the call into the delegate, specifically. Navel will guarantee that it is safe to cast the bean argument to this type.
bean - Dynamic Proxy that was just created, provided so that its state may be initialized as desired.
See Also:
ConstructionDelegate.initValues(int, Class, Object)

initBehaviors

public void initBehaviors(int nestingDepth,
                          java.lang.Class<?> thisType,
                          java.lang.Object bean)
Description copied from interface: ConstructionDelegate
This code will get invoked any any new Navel been that implements the type for which this instance is registered immediately after the Proxy is created but before the reference is returned out of ProxyFactory making this suitable to do custom "construction" work. The implementer should take care of both direct value initialization on the bean argument and attachment of any stock PropertyDelegate instances, as these are both germane to the initial observable state of the object under construction. This code will get invoked during a copy of all kinds, this includes ProxyFactory.unmodifiableObject(Object) and ProxyFactory.unmodifiableObjectAs(Class, Object).

Specified by:
initBehaviors in interface ConstructionDelegate
Parameters:
nestingDepth - For directly or indirectly recursive relationships between types, this argument lets the delegate consider nesting depth as part of its criteria as to whether it should do anything special.
thisType - This is the type that triggered the call into the delegate, specifically. Navel will guarantee that it is safe to cast the bean argument to this type.
bean - Dynamic Proxy that was just created, provided so that its state may be initialized as desired.
See Also:
ConstructionDelegate.initBehaviors(int, java.lang.Class, java.lang.Object)