|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
CyclicDependencyException.java | - | 100% | 100% | 100% |
|
1 |
/*****************************************************************************
|
|
2 |
* Copyright (c) PicoContainer Organization. All rights reserved. *
|
|
3 |
* ------------------------------------------------------------------------- *
|
|
4 |
* The software in this package is published under the terms of the BSD *
|
|
5 |
* style license a copy of which has been included with this distribution in *
|
|
6 |
* the LICENSE.txt file. *
|
|
7 |
* *
|
|
8 |
* Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant *
|
|
9 |
*****************************************************************************/
|
|
10 |
|
|
11 |
package org.picocontainer.defaults;
|
|
12 |
|
|
13 |
import org.picocontainer.PicoIntrospectionException;
|
|
14 |
|
|
15 |
import java.util.LinkedList;
|
|
16 |
import java.util.List;
|
|
17 |
|
|
18 |
/**
|
|
19 |
* @author Aslak Hellesøy
|
|
20 |
* @author Jörg Schaible
|
|
21 |
* @version $Revision: 1.9 $
|
|
22 |
*/
|
|
23 |
public class CyclicDependencyException extends PicoIntrospectionException { |
|
24 |
private final List stack;
|
|
25 |
|
|
26 |
/**
|
|
27 |
* @since 1.1
|
|
28 |
*/
|
|
29 | 22 |
public CyclicDependencyException(Class element) {
|
30 | 22 |
super((Throwable)null); |
31 | 22 |
this.stack = new LinkedList(); |
32 | 22 |
push(element); |
33 |
} |
|
34 |
|
|
35 |
/**
|
|
36 |
* @since 1.1
|
|
37 |
*/
|
|
38 | 64 |
public void push(Class element) { |
39 | 64 |
stack.add(element); |
40 |
} |
|
41 |
|
|
42 | 22 |
public Class[] getDependencies() {
|
43 | 22 |
return (Class[]) stack.toArray(new Class[stack.size()]); |
44 |
} |
|
45 |
|
|
46 | 2 |
public String getMessage() {
|
47 | 2 |
return "Cyclic dependency: " + stack.toString(); |
48 |
} |
|
49 |
} |
|
50 |
|
|