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.internal.util;
014    
015    import java.lang.reflect.AccessibleObject;
016    import java.security.PrivilegedAction;
017    
018    /**
019     * @author Sebastian Thomschke
020     */
021    public final class SetAccessibleAction implements PrivilegedAction<Object>
022    {
023            private final AccessibleObject ao;
024    
025            public SetAccessibleAction(final AccessibleObject ao)
026            {
027                    this.ao = ao;
028            }
029    
030            /**
031             * {@inheritDoc}
032             */
033            public Object run()
034            {
035                    ao.setAccessible(true);
036                    return null;
037            }
038    }