本文整理汇总了Java中com.intellij.util.ReflectionUtil.getMethod方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtil.getMethod方法的具体用法?Java ReflectionUtil.getMethod怎么用?Java ReflectionUtil.getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ReflectionUtil
的用法示例。
在下文中一共展示了ReflectionUtil.getMethod方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertyValue
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
@Nullable
private static Object getPropertyValue(Object componentInstance, String propertyName) {
final Class<? extends Object> componentInstanceClass = componentInstance.getClass();
Object propertyValue = ReflectionUtil.getField(componentInstanceClass, componentInstance, null, propertyName);
if (propertyValue == null) {
Method method = ReflectionUtil.getMethod(componentInstanceClass, "get" + StringUtil.capitalize(propertyName));
if (method == null) {
method = ReflectionUtil.getMethod(componentInstanceClass, "is" + StringUtil.capitalize(propertyName));
}
if (method != null) {
try {
propertyValue = method.invoke(componentInstance);
}
catch (Exception ignored) {
}
}
}
return propertyValue;
}
示例2: captureMemorySnapshot
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private static void captureMemorySnapshot() {
try {
Method snapshot = ReflectionUtil.getMethod(Class.forName("com.intellij.util.ProfilingUtil"), "forceCaptureMemorySnapshot");
if (snapshot != null) {
snapshot.invoke(null);
}
}
catch (Exception ignored) { }
}
示例3: findGetter
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
@Nullable
public static JavaMethod findGetter(Class aClass, String propertyName) {
final String capitalized = StringUtil.capitalize(propertyName);
Method method = ReflectionUtil.getMethod(aClass, "get" + capitalized);
if (method != null) return JavaMethod.getMethod(aClass, method);
method = ReflectionUtil.getMethod(aClass, "is" + capitalized);
if (method == null) return null;
final JavaMethod javaMethod = JavaMethod.getMethod(aClass, method);
return canHaveIsPropertyGetterPrefix(javaMethod.getGenericReturnType()) ? javaMethod : null;
}
示例4: method
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private static Method method(String name, Class<?>... parameterTypes) {
List<String> parts = StringUtil.split(name, "#");
Class<?> aClass = cls(parts.get(0));
String methodName = parts.get(1);
return ReflectionUtil.getMethod(aClass, methodName, parameterTypes);
}
示例5: getDeclaredMethod
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
@Nullable
private Method getDeclaredMethod(final Class aClass) {
final Method method = ReflectionUtil.getMethod(aClass, myMethodName, myMethodParameters);
return method == null ? ReflectionUtil.getDeclaredMethod(aClass, myMethodName, myMethodParameters) : method;
}