net.sf.jguiraffe.di.impl
Class NameDependency

java.lang.Object
  extended by net.sf.jguiraffe.di.impl.NameDependency
All Implemented Interfaces:
Dependency

public class NameDependency
extends java.lang.Object
implements Dependency

An implementation of the Dependency interface that allows to define a dependency based on the name of a bean.

Version:
$Id: NameDependency.java 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger

Method Summary
 boolean equals(java.lang.Object obj)
          Tests whether this object equals another one.
static NameDependency getInstance(java.lang.String name)
          Returns an instance of this class for the bean with the specified name.
 java.lang.String getName()
          Returns the name of the dependent bean.
 int hashCode()
          Returns a hash code for this object.
 BeanProvider resolve(BeanStore store, DependencyProvider depProvider)
          Resolves the named dependency from the specified bean store.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
Returns the name of the dependent bean.

Returns:
the name of the bean this dependency refers to

resolve

public BeanProvider resolve(BeanStore store,
                            DependencyProvider depProvider)
Resolves the named dependency from the specified bean store. This is done recursively for the bean store's parent if necessary.

Specified by:
resolve in interface Dependency
Parameters:
store - the bean store
depProvider - the dependency provider (not used here)
Returns:
the found bean provider
Throws:
InjectionException - if the provider cannot be resolved

equals

public boolean equals(java.lang.Object obj)
Tests whether this object equals another one. Two objects of this class are considered equal if and only if they refer to the same dependent bean.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare to
Returns:
a flag whether the objects are equal

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code

toString

public java.lang.String toString()
Returns a string representation of this object. This string especially contains the name of the bean this dependency is about.

Overrides:
toString in class java.lang.Object
Returns:
a string for this object

getInstance

public static NameDependency getInstance(java.lang.String name)
Returns an instance of this class for the bean with the specified name.

Parameters:
name - the name of the dependent bean
Returns:
an instance referring to the specified dependent bean


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.