rafa.dep
Interface Dependency

All Known Implementing Classes:
GeneratorDependency, SimpleDependency

public interface Dependency

Interface to describe a dependency of an object on another one.

Author:
rafa

Method Summary
 void addProperty(java.lang.Object key, java.lang.Object value)
          Adds a property to describe this dependency, overwriting it in case it already exists.
 java.util.List<Dependent> getPath()
           
 java.util.Map<java.lang.Object,java.lang.Object> getProperties()
           
 java.lang.Object getTarget()
           
 java.util.Collection<Dependency> search(java.lang.Object subTarget)
          Searches a sub-dependency within this object's target.
 void validateCircularDependency()
          Checks that a dependency held by an object on itself is valid.
 

Method Detail

getTarget

java.lang.Object getTarget()
Returns:
The target of the dependency.

getPath

java.util.List<Dependent> getPath()
Returns:
The dependency path, i.e. the list of objects between the dependent object - holder of this dependency - and the final target (both excluded), or null if this is a direct dependency.

addProperty

void addProperty(java.lang.Object key,
                 java.lang.Object value)
Adds a property to describe this dependency, overwriting it in case it already exists.

Parameters:
key -
value -

getProperties

java.util.Map<java.lang.Object,java.lang.Object> getProperties()

search

java.util.Collection<Dependency> search(java.lang.Object subTarget)
Searches a sub-dependency within this object's target.

Parameters:
subTarget - the searched object.
Returns:
a number of dependencies on the passed object, whose path includes the target of this dependency as first item, or null if none found.

validateCircularDependency

void validateCircularDependency()
                                throws CircularDependencyException
Checks that a dependency held by an object on itself is valid. This implementation does not allow any circular dependencies, but subclasses can override this method and check the dependency properties.

Throws:
CircularDependencyException


Copyright © 2008-2009. All Rights Reserved.