jfun.yan
Interface Dependency

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
ManualDependency, SimpleDependency

public interface Dependency
extends java.io.Serializable

This interface is responsible for providing dependency to the creation of a component instance.

Codehaus.org.

Author:
Ben Yu

Method Summary
 java.lang.Object getArgument(Signature source, 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 key, java.lang.Class type)
          Get an instance of a property.
 Dependency seal()
          To create a Dependency that's free of auto-wiring.
 java.lang.Class verifyArgument(Signature source, 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 key, java.lang.Class type)
          Verifies that the property instance can be resolved.
 

Method Detail

getArgument

java.lang.Object getArgument(Signature source,
                             int i,
                             java.lang.Class type)
                             throws IrresolveableArgumentException,
                                    ParameterTypeMismatchException,
                                    AmbiguousComponentResolutionException,
                                    ComponentInstantiationException,
                                    YanException
Get an instance of an argument.

Parameters:
source - 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.
Throws:
IrresolveableArgumentException - if the argument cannot be resolved.
ParameterTypeMismatchException - if the actual type of the argument does not match the expected parameter type.
AmbiguousComponentResolutionException - if ambiguity happens.
ComponentInstantiationException - if any checked exception happens when instantiating the argument.
YanException - if any other component related error happens.

verifyArgument

java.lang.Class verifyArgument(Signature source,
                               int i,
                               java.lang.Class type)
                               throws IrresolveableArgumentException,
                                      ParameterTypeMismatchException,
                                      AmbiguousComponentResolutionException,
                                      YanException
Verifies that the argument instance can be resolved. The actual argument type is returned if verification succeeds.

Parameters:
source - 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.
Throws:
IrresolveableArgumentException - if the argument cannot be resolved.
ParameterTypeMismatchException - if the actual type of the argument does not match the expected parameter type.
AmbiguousComponentResolutionException - if ambiguity happens.
YanException - if any other component related error happens.

getProperty

java.lang.Object getProperty(java.lang.Class component_type,
                             java.lang.Object key,
                             java.lang.Class type)
                             throws IrresolveablePropertyException,
                                    PropertyTypeMismatchException,
                                    AmbiguousComponentResolutionException,
                                    ComponentInstantiationException,
                                    YanException
Get an instance of a property.

Parameters:
component_type - the type of the component requesting the property.
key - the key of the property.
type - the property type.
Returns:
the property instance.
Throws:
IrresolveablePropertyException - if the property cannot be resolved.
PropertyTypeMismatchException - if the actual type of the property does not match the expected property type.
AmbiguousComponentResolutionException - if ambiguity happens.
ComponentInstantiationException - if any checked exception happens when instantiating the property.
YanException - if any other component related error happens.

verifyProperty

java.lang.Class verifyProperty(java.lang.Class component_type,
                               java.lang.Object key,
                               java.lang.Class type)
                               throws IrresolveablePropertyException,
                                      PropertyTypeMismatchException,
                                      AmbiguousComponentResolutionException,
                                      YanException
Verifies that the property instance can be resolved. The actual type of the property is returned if verification succeeds.

Parameters:
component_type - the type of the component requesting the property.
key - the property key.
type - the expected property type.
Returns:
the actual type of the property.
Throws:
IrresolveablePropertyException - if the property cannot be resolved.
PropertyTypeMismatchException - if the actual type of the property does not match the expected property type.
AmbiguousComponentResolutionException - if ambiguity happens.
YanException - if any other component related error happens.

getOriginal

Dependency getOriginal()
To get the Dependency object before the current one is customized, if any.


getComponentMap

ComponentMap getComponentMap()
Get the ComponentMap object.

Returns:
the ComponentMap object.

getComponentKey

java.lang.Object getComponentKey()
Get the key of the component being resolved.

Returns:
the context.

getParent

Dependency getParent()
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.

Returns:
the dependency for the parent component.

seal

Dependency seal()
To create a Dependency that's free of auto-wiring.