站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

MethodComparator (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.util.asm
Class MethodComparator

java.lang.Object
  extended by org.drools.util.asm.MethodComparator

public class MethodComparator
extends Object

The purpose of this utility it to check if 2 method implementations are equivalent, by comparing the bytecode. This essentual for node sharing where java semantics are involved.

Author:
Michael Neale

Nested Class Summary
static class MethodComparator.Tracer
           
 
Constructor Summary
MethodComparator()
           
 
Method Summary
static boolean compareBytecode(List b1, List b2)
          Compares 2 bytecode listings.
 boolean equivalent(String method1, ClassReader class1, String method2, ClassReader class2)
          This actually does the comparing.
static List getMethodBytecode(String methodName, byte[] bytes)
          This will return a series of bytecode instructions which can be used to compare one method with another.
 List getMethodBytecode(String methodName, ClassReader classReader)
          This will return a series of bytecode instructions which can be used to compare one method with another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodComparator

public MethodComparator()
Method Detail

equivalent

public boolean equivalent(String method1,
                          ClassReader class1,
                          String method2,
                          ClassReader class2)
This actually does the comparing. Class1 and Class2 are class reader instances to the respective classes. method1 and method2 are looked up on the respective classes and their contents compared. This is a convenience method.


getMethodBytecode

public List getMethodBytecode(String methodName,
                              ClassReader classReader)
This will return a series of bytecode instructions which can be used to compare one method with another. debug info like local var declarations and line numbers are ignored, so the focus is on the content.


getMethodBytecode

public static List getMethodBytecode(String methodName,
                                     byte[] bytes)
This will return a series of bytecode instructions which can be used to compare one method with another. debug info like local var declarations and line numbers are ignored, so the focus is on the content.


compareBytecode

public static boolean compareBytecode(List b1,
                                      List b2)
Compares 2 bytecode listings. Returns true if they are identical.



Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.