Here you can find the source of getPublicPutMethodForResultClass(final Class resultClass)
Parameter | Description |
---|---|
resultClass | The result class |
public static Method getPublicPutMethodForResultClass(final Class resultClass)
//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; } } }); } }