jfun.yan
Class ManualDependency

java.lang.Object
  extended by jfun.yan.ManualDependency
All Implemented Interfaces:
java.io.Serializable, Dependency

public class ManualDependency
extends java.lang.Object
implements Dependency

ManualDependency disables auto-wiring by refusing to resolve any component part. When ManualDependency is used, all properties and parameters need to be explicitly specified using Component.withArgument(), Component.withArguments(), Component.withProperty() and Component.withProperties().

Codehaus.org.

Author:
Ben Yu
See Also:
Serialized Form

Constructor Summary
ManualDependency(ComponentMap cmap, java.lang.Object ckey)
          Create a new ManualDependency object.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getArgument(Signature src, int i, java.lang.Class type)
          Get an instance of an argument.
 java.lang.Object getComponentKey()
          Get the key of the component being resolved.
 ComponentMap getComponentMap()
          Get the ComponentMap object.
 Dependency getOriginal()
          To get the Dependency object before the current one is customized, if any.
 Dependency getParent()
          Get the dependency for the parent component.
 java.lang.Object getProperty(java.lang.Class component_type, java.lang.Object local_key, java.lang.Class type)
          Get an instance of a property.
 int hashCode()
           
 Dependency seal()
          To create a Dependency that's free of auto-wiring.
 java.lang.String toString()
           
 java.lang.Class verifyArgument(Signature src, int i, java.lang.Class type)
          Verifies that the argument instance can be resolved.
 java.lang.Class verifyProperty(java.lang.Class component_type, java.lang.Object local_key, java.lang.Class type)
          Verifies that the property instance can be resolved.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManualDependency

public ManualDependency(ComponentMap cmap,
                        java.lang.Object ckey)
Create a new ManualDependency object.

Parameters:
cmap - the ComponentMap object.
ckey - the component key.
Method Detail

getArgument

public java.lang.Object getArgument(Signature src,
                                    int i,
                                    java.lang.Class type)
Description copied from interface: Dependency
Get an instance of an argument.

Specified by:
getArgument in interface Dependency
Parameters:
src - the signature of the function requesting this argument.
i - the ordinal position of the argument. Starting from 0.
type - the parameter type.
Returns:
the argument instance.

getProperty

public java.lang.Object getProperty(java.lang.Class component_type,
                                    java.lang.Object local_key,
                                    java.lang.Class type)
Description copied from interface: Dependency
Get an instance of a property.

Specified by:
getProperty in interface Dependency
Parameters:
component_type - the type of the component requesting the property.
local_key - the key of the property.
type - the property type.
Returns:
the property instance.

verifyArgument

public java.lang.Class verifyArgument(Signature src,
                                      int i,
                                      java.lang.Class type)
Description copied from interface: Dependency
Verifies that the argument instance can be resolved. The actual argument type is returned if verification succeeds.

Specified by:
verifyArgument in interface Dependency
Parameters:
src - the signature of the function requesting this argument.
i - the ordinal position of the argument. Starting from 0.
type - the parameter type.
Returns:
the actual type of the argument.

verifyProperty

public java.lang.Class verifyProperty(java.lang.Class component_type,
                                      java.lang.Object local_key,
                                      java.lang.Class type)
Description copied from interface: Dependency
Verifies that the property instance can be resolved. The actual type of the property is returned if verification succeeds.

Specified by:
verifyProperty in interface Dependency
Parameters:
component_type - the type of the component requesting the property.
local_key - the property key.
type - the expected property type.
Returns:
the actual type of the property.

getComponentMap

public ComponentMap getComponentMap()
Description copied from interface: Dependency
Get the ComponentMap object.

Specified by:
getComponentMap in interface Dependency
Returns:
the ComponentMap object.

getComponentKey

public java.lang.Object getComponentKey()
Description copied from interface: Dependency
Get the key of the component being resolved.

Specified by:
getComponentKey in interface Dependency
Returns:
the context.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParent

public Dependency getParent()
Description copied from interface: Dependency
Get the dependency for the parent component. if component 1 is resolved as a part of component 2, component 2 is considered the parent component of component 1. If there's no parent component, null is returned.

Specified by:
getParent in interface Dependency
Returns:
the dependency for the parent component.

getOriginal

public Dependency getOriginal()
Description copied from interface: Dependency
To get the Dependency object before the current one is customized, if any.

Specified by:
getOriginal in interface Dependency

seal

public Dependency seal()
Description copied from interface: Dependency
To create a Dependency that's free of auto-wiring.

Specified by:
seal in interface Dependency