001    /*******************************************************************************
002     * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
003     * Thomschke.
004     * 
005     * All Rights Reserved. This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     * 
010     * Contributors:
011     *     Sebastian Thomschke - initial implementation.
012     *******************************************************************************/
013    package net.sf.oval.exception;
014    
015    import net.sf.oval.context.OValContext;
016    import net.sf.oval.internal.MessageRenderer;
017    
018    /**
019     * @author Sebastian Thomschke
020     */
021    public class AccessingFieldValueFailedException extends ReflectionException
022    {
023            private static final long serialVersionUID = 1L;
024    
025            private final OValContext context;
026            private final Object validatedObject;
027    
028            public AccessingFieldValueFailedException(final String fieldName, final Object validatedObject,
029                            final OValContext context, final Throwable cause)
030            {
031                    super(MessageRenderer.renderMessage("net.sf.oval.exception.AccessingFieldValueFailedException.message",
032                                    "fieldName", fieldName), cause);
033                    this.context = context;
034                    this.validatedObject = validatedObject;
035            }
036    
037            /**
038             * @return Returns the context.
039             */
040            public OValContext getContext()
041            {
042                    return context;
043            }
044    
045            /**
046             * @return the validatedObject
047             */
048            public Object getValidatedObject()
049            {
050                    return validatedObject;
051            }
052    }