001/*****************************************************************************
002 * Copyright (c) PicoContainer Organization. All rights reserved.            *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD      *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file.                                                     *
007 *                                                                           *
008 *****************************************************************************/
009
010package org.picocontainer;
011
012import java.lang.reflect.Method;
013
014@SuppressWarnings("serial")
015public class PicoLifecycleException extends PicoException {
016
017    private final Method method;
018    private final Object instance;
019
020    public PicoLifecycleException(final Method method, final Object instance, final Throwable cause) {
021        super(cause);
022        this.method = method;
023        this.instance = instance;
024    }
025
026    public Method getMethod() {
027        return method;
028    }
029
030    public Object getInstance() {
031        return instance;
032    }
033
034    public String getMessage() {
035        return "PicoLifecycleException: method '" + method + "', instance '"+ instance + ", " + super.getMessage();
036    }
037
038}