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


Java MethodDescriptor.getMethod方法代码示例

本文整理汇总了Java中java.beans.MethodDescriptor.getMethod方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDescriptor.getMethod方法的具体用法?Java MethodDescriptor.getMethod怎么用?Java MethodDescriptor.getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.MethodDescriptor的用法示例。


在下文中一共展示了MethodDescriptor.getMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _makeQualifiedMethodName

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private String _makeQualifiedMethodName(
  MethodDescriptor descriptor
  )
{
  Method        m = descriptor.getMethod();
  StringBuffer sb = new StringBuffer();

  sb.append(m.getName());
  sb.append("=");

  Class params[] = m.getParameterTypes();

  for (int i = 0; i < params.length; i++)
  {
    sb.append(":");
    sb.append(params[i].getName());
  }

  return sb.toString();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:JavaIntrospector.java

示例2: _createMergedMethodDescriptor

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private static MethodDescriptor _createMergedMethodDescriptor(
   MethodDescriptor secondaryDescriptor,
   MethodDescriptor primaryDescriptor
   )
 {
   ParameterDescriptor[] parameterDescriptors =
                                 primaryDescriptor.getParameterDescriptors();

  if (parameterDescriptors == null)
  {
    parameterDescriptors = secondaryDescriptor.getParameterDescriptors();
  }

  MethodDescriptor mergedDescriptor = new MethodDescriptor(
                                           primaryDescriptor.getMethod(),
                                           parameterDescriptors);

  // merge the superclasses
  _mergeFeatureDescriptors(secondaryDescriptor,
                           primaryDescriptor,
                           mergedDescriptor);

  return mergedDescriptor;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:25,代码来源:JavaIntrospector.java

示例3: _cloneMethodDescriptor

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private static MethodDescriptor _cloneMethodDescriptor(
  MethodDescriptor oldDescriptor
  )
{
  try
  {
    MethodDescriptor newDescriptor = new MethodDescriptor(
                                  oldDescriptor.getMethod(),
                                  oldDescriptor.getParameterDescriptors());

    // copy the rest of the attributes
    _copyFeatureDescriptor(oldDescriptor, newDescriptor);

    return newDescriptor;
  }
  catch (Exception e)
  {
    _LOG.severe(e);
    return null;
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:JavaIntrospector.java

示例4: findCandidateWriteMethods

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
	List<Method> matches = new ArrayList<Method>();
	for (MethodDescriptor methodDescriptor : methodDescriptors) {
		Method method = methodDescriptor.getMethod();
		if (isCandidateWriteMethod(method)) {
			matches.add(method);
		}
	}
	// sort non-void returning write methods to guard against the ill effects of
	// non-deterministic sorting of methods returned from Class#getDeclaredMethods
	// under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180
	Collections.sort(matches, new Comparator<Method>() {
		@Override
		public int compare(Method m1, Method m2) {
			return m2.toString().compareTo(m1.toString());
		}
	});
	return matches;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:ExtendedBeanInfo.java

示例5: findMethod

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private static Method findMethod(Class<?> targetType, String methodName,
        Class<?>[] argTypes) throws IntrospectionException {
    BeanInfo beanInfo = Introspector.getBeanInfo(targetType);
    if (beanInfo != null) {
        for(MethodDescriptor methodDesc: beanInfo.getMethodDescriptors()) {
            Method method = methodDesc.getMethod();
            Class<?>[] parameterTypes = method.getParameterTypes();
            if (methodName.equals(method.getName()) && argTypes.length == parameterTypes.length) {
                boolean matchedArgTypes = true;
                for (int i = 0; i < argTypes.length; i++) { 
                    if (getWrapperIfPrimitive(argTypes[i]) != parameterTypes[i]) {
                        matchedArgTypes = false;
                        break;
                    }
                }
                if (matchedArgTypes) {
                    return method;
                }
            }
        }
    }
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:QuartzSchedulerMBeanImpl.java

示例6: findCandidateWriteMethods

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
	List<Method> matches = new ArrayList<Method>();
	for (MethodDescriptor methodDescriptor : methodDescriptors) {
		Method method = methodDescriptor.getMethod();
		if (isCandidateWriteMethod(method)) {
			matches.add(method);
		}
	}
	// Sort non-void returning write methods to guard against the ill effects of
	// non-deterministic sorting of methods returned from Class#getDeclaredMethods
	// under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180
	Collections.sort(matches, new Comparator<Method>() {
		@Override
		public int compare(Method m1, Method m2) {
			return m2.toString().compareTo(m1.toString());
		}
	});
	return matches;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:ExtendedBeanInfo.java

示例7: getGlobalInfo

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
/**
 * Return the global info (if it exists) for the supplied clusterer
 * 
 * @param clusterer the clusterer to get the global info for
 * @return the global info (synopsis) for the clusterer
 * @throws Exception if there is a problem reflecting on the clusterer
 */
protected static String getGlobalInfo(Clusterer clusterer) throws Exception {
  BeanInfo bi = Introspector.getBeanInfo(clusterer.getClass());
  MethodDescriptor[] methods;
  methods = bi.getMethodDescriptors();
  Object[] args = {};
  String result =
    "\nSynopsis for " + clusterer.getClass().getName() + ":\n\n";

  for (MethodDescriptor method : methods) {
    String name = method.getDisplayName();
    Method meth = method.getMethod();
    if (name.equals("globalInfo")) {
      String globalInfo = (String) (meth.invoke(clusterer, args));
      result += globalInfo;
      break;
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:28,代码来源:ClusterEvaluation.java

示例8: getGlobalInfo

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
/**
 * Return the global info (if it exists) for the supplied classifier.
 * 
 * @param classifier the classifier to get the global info for
 * @return the global info (synopsis) for the classifier
 * @throws Exception if there is a problem reflecting on the classifier
 */
protected static String getGlobalInfo(Classifier classifier) throws Exception {
  BeanInfo bi = Introspector.getBeanInfo(classifier.getClass());
  MethodDescriptor[] methods;
  methods = bi.getMethodDescriptors();
  Object[] args = {};
  String result =
    "\nSynopsis for " + classifier.getClass().getName() + ":\n\n";

  for (MethodDescriptor method : methods) {
    String name = method.getDisplayName();
    Method meth = method.getMethod();
    if (name.equals("globalInfo")) {
      String globalInfo = (String) (meth.invoke(classifier, args));
      result += globalInfo;
      break;
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:28,代码来源:Evaluation.java

示例9: getGlobalInfo

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
/**
 * Return the global info (if it exists) for the supplied clusterer
 * 
 * @param clusterer the clusterer to get the global info for
 * @return the global info (synopsis) for the clusterer
 * @throws Exception if there is a problem reflecting on the clusterer
 */
protected static String getGlobalInfo(Clusterer clusterer) throws Exception {
  BeanInfo bi = Introspector.getBeanInfo(clusterer.getClass());
  MethodDescriptor[] methods;
  methods = bi.getMethodDescriptors();
  Object[] args = {};
  String result = "\nSynopsis for " + clusterer.getClass().getName()
    + ":\n\n";

  for (MethodDescriptor method : methods) {
    String name = method.getDisplayName();
    Method meth = method.getMethod();
    if (name.equals("globalInfo")) {
      String globalInfo = (String) (meth.invoke(clusterer, args));
      result += globalInfo;
      break;
    }
  }

  return result;
}
 
开发者ID:umple,项目名称:umple,代码行数:28,代码来源:ClusterEvaluation.java

示例10: getGlobalInfo

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
/**
 * Return the global info (if it exists) for the supplied classifier.
 *
 * @param classifier the classifier to get the global info for
 * @return the global info (synopsis) for the classifier
 * @throws Exception if there is a problem reflecting on the classifier
 */
protected static String getGlobalInfo(Classifier classifier) throws Exception {
  BeanInfo bi = Introspector.getBeanInfo(classifier.getClass());
  MethodDescriptor[] methods;
  methods = bi.getMethodDescriptors();
  Object[] args = {};
  String result = "\nSynopsis for " + classifier.getClass().getName()
    + ":\n\n";

  for (MethodDescriptor method : methods) {
    String name = method.getDisplayName();
    Method meth = method.getMethod();
    if (name.equals("globalInfo")) {
      String globalInfo = (String) (meth.invoke(classifier, args));
      result += globalInfo;
      break;
    }
  }

  return result;
}
 
开发者ID:umple,项目名称:umple,代码行数:28,代码来源:Evaluation.java

示例11: findCandidateWriteMethods

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
	List<Method> matches = new ArrayList<Method>();
	for (MethodDescriptor methodDescriptor : methodDescriptors) {
		Method method = methodDescriptor.getMethod();
		if (isCandidateWriteMethod(method)) {
			matches.add(method);
		}
	}
	// sort non-void returning write methods to guard against the ill effects of
	// non-deterministic sorting of methods returned from Class#getDeclaredMethods
	// under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180
	Collections.sort(matches, new Comparator<Method>() {
		public int compare(Method m1, Method m2) {
			return m2.toString().compareTo(m1.toString());
		}
	});
	return matches;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:19,代码来源:ExtendedBeanInfo.java

示例12: getGlobalInfo

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
/**
 * Return the global info (if it exists) for the supplied classifier
 *
 * @param classifier the classifier to get the global info for
 * @return the global info (synopsis) for the classifier
 * @throws Exception if there is a problem reflecting on the classifier
 */
protected static String getGlobalInfo(Classifier classifier) throws Exception {
    BeanInfo bi = Introspector.getBeanInfo(classifier.getClass());
    MethodDescriptor[] methods;
    methods = bi.getMethodDescriptors();
    Object[] args = {};
    String result =
            "\nSynopsis for " + classifier.getClass().getName() + ":\n\n";

    for (MethodDescriptor method : methods) {
        String name = method.getDisplayName();
        Method meth = method.getMethod();
        if (name.equals("globalInfo")) {
            String globalInfo = (String) (meth.invoke(classifier, args));
            result += globalInfo;
            break;
        }
    }

    return result;
}
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:28,代码来源:Evaluation.java

示例13: findBeanInfoCandidate

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
protected <T> Method findBeanInfoCandidate(final int paramCount, final String methodName,
    final MethodDescriptor[] methodDescriptors, final boolean staticOnly) {
  for (final MethodDescriptor mDescriptor : methodDescriptors) {
    if (mDescriptor.getName().equals(methodName)) {
      final Method method = mDescriptor.getMethod();

      if (isMethodValid(method, staticOnly)
          && ((method.isVarArgs() && ((method.getParameterTypes().length - paramCount) <= 1)) || (method
              .getParameterTypes().length == paramCount))) {
        return method;
      }
    }
  }

  return null;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:17,代码来源:BeanELResolverEx.java

示例14: main

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
public static void main(String[] args) throws IntrospectionException {
    Class type = BASE64Encoder.class;
    System.setSecurityManager(new SecurityManager());
    BeanInfo info = Introspector.getBeanInfo(type);
    for (MethodDescriptor md : info.getMethodDescriptors()) {
        Method method = md.getMethod();
        System.out.println(method);

        String name = method.getDeclaringClass().getName();
        if (name.startsWith("sun.misc.")) {
            throw new Error("found inaccessible method");
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:Test6277246.java

示例15: main

import java.beans.MethodDescriptor; //导入方法依赖的package包/类
public static void main(String[] args) throws IntrospectionException {
    Class type = sun.security.x509.X509CertInfo.class;
    System.setSecurityManager(new SecurityManager());
    BeanInfo info = Introspector.getBeanInfo(type);
    for (MethodDescriptor md : info.getMethodDescriptors()) {
        Method method = md.getMethod();
        System.out.println(method);

        String name = method.getDeclaringClass().getName();
        if (name.startsWith("sun.")) {
            throw new Error("found inaccessible method");
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Test6277246.java


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