Package net.sf.jguiraffe.di.impl
Class NameDependency
- java.lang.Object
-
- net.sf.jguiraffe.di.impl.NameDependency
-
- All Implemented Interfaces:
Dependency
public final class NameDependency extends 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 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Tests whether this object equals another one.static NameDependency
getInstance(String name)
Returns an instance of this class for the bean with the specified name.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.String
toString()
Returns a string representation of this object.
-
-
-
Method Detail
-
getName
public 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 interfaceDependency
- Parameters:
store
- the bean storedepProvider
- the dependency provider (not used here)- Returns:
- the found bean provider
- Throws:
InjectionException
- if the provider cannot be resolved
-
equals
public boolean equals(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.
-
hashCode
public int hashCode()
Returns a hash code for this object.
-
toString
public String toString()
Returns a string representation of this object. This string especially contains the name of the bean this dependency is about.
-
getInstance
public static NameDependency getInstance(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
-
-