Java Key Public getPublicPutMethodForResultClass(final Class resultClass)

Here you can find the source of getPublicPutMethodForResultClass(final Class resultClass)

Description

Convenience method to return the put(Object, Object method for the result class.

License

Open Source License

Parameter

Parameter Description
resultClass The result class

Return

The put(Object, Object) method

Declaration

public static Method getPublicPutMethodForResultClass(final Class resultClass) 

Method Source Code

//package com.java2s;
/**********************************************************************
Copyright (c) 2005 Andy Jefferson and others. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at/*from www .  j  ava  2 s.c  o  m*/
    
http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    
Contributors:
...
**********************************************************************/

import java.lang.reflect.Method;

import java.security.AccessController;
import java.security.PrivilegedAction;

public class Main {
    /** Convenience Class[] for parameter types in getMethod call. */
    final static Class[] classArrayObjectObject = new Class[] { Object.class, Object.class };

    /**
     * Convenience method to return the put(Object, Object method for the result class.
     * @param resultClass The result class
     * @return The put(Object, Object) method
     */
    public static Method getPublicPutMethodForResultClass(final Class resultClass) {
        return (Method) AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                try {
                    return resultClass.getMethod("put", classArrayObjectObject);
                } catch (NoSuchMethodException ex) {
                    return null;
                }
            }
        });
    }
}

Related

  1. getPublicKeyFromFile(File cert, String alias, String password)
  2. getPublicKeyFromPEMFile(String fileName, String jceProvider)
  3. getPublicKeyFromString(String certificateString)
  4. getPublicKeyModulus(RSAPublicKey publicKey)
  5. getPublicKeySpec(KeyPair kp)