001    /*
002    This project provide access to non public fields
003    and methods as help for writing tests.
004    Copyright (C) 2007  Christof Lehmann
005    
006    This program is free software; you can redistribute it and/or
007    modify it under the terms of the GNU General Public License
008    as published by the Free Software Foundation; either version 2
009    of the License, or (at your option) any later version.
010    
011    This program is distributed in the hope that it will be useful,
012    but WITHOUT ANY WARRANTY; without even the implied warranty of
013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014    GNU General Public License for more details.
015    
016    You should have received a copy of the GNU General Public License
017    along with this program; if not, write to the Free Software
018    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019     */
020    package net.sf.testextensions;
021    
022    /**
023     * The interface <code>AccessObject</code> declares the methods
024     * to access non public fields and methods. The implementation
025     * of the AccessObject should enclose all the nessecary things.
026     * @author forge-cl
027     *
028     */
029    public interface AccessObject {
030    
031            /**
032             * The methode <code>getField</code> select a field
033             * for manipulation.
034             * @param fieldName the name of the wished field.
035             * @return an instance of AccessField
036             * @throws TestExtensionException the exception shows an
037             * error, when preparing the access to the field.
038             */
039            AccessField getField(String fieldName) throws TestExtensionException;
040    
041            /**
042             * The method <code>getMethod</code> provide access to
043             * a by name called method. If there exists several methods
044             * with the same name, all methods were accessed by this method.
045             * @param methodName the name of the method.
046             * @return an object, which provide access to the method.
047             * @throws TestExtensionException the exception shows an
048             * error, when preparing the access to the method, for instance
049             * when no method was found.
050             */
051            AccessMethod getMethod(String methodName) throws TestExtensionException;
052    
053            /**
054             * The method <code>newInnerInstance</code> create a instance of an
055             * inner class from the current object.
056             * @param innerClassname The name of the inner class without the prefix for
057             *      the outer class.
058             * @return a new instance of an inner class of the current object.
059             * @throws TestExtensionException shows any error.
060             */
061            AccessObject newInnerInstance(String innerClassname)
062                    throws TestExtensionException;
063    
064            /**
065             * The method <code>newInnerInstance</code> create a instance of an inner
066             * class from the current object.
067             *
068             * @param innerClassname
069             *            The name of the inner class without the prefix for the outer
070             *            class.
071             * @param args
072             *            the arguments for the constructor.
073             * @return a new instance of an inner class of the current object.
074             * @throws TestExtensionException
075             *             shows any error.
076             */
077            AccessObject newInnerInstance(String innerClassname, Object[] args)
078                    throws TestExtensionException;
079    
080    }