当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionUtil.getMethod方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:IdeSettingsStatisticsUtils.java

示例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) { }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:_LastInSuiteTest.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DomReflectionUtil.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JrtHandler.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JavaMethodSignature.java


注:本文中的com.intellij.util.ReflectionUtil.getMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。