org.springsource.loaded
Class MethodInvokerRewriter

java.lang.Object
  extended by org.springsource.loaded.MethodInvokerRewriter

public class MethodInvokerRewriter
extends java.lang.Object

Rewrite method calls and field accesses. This is not only references to reloadable types but also calls to reflective APIs which must be intercepted in case they refer to reloadable types at runtime.

The MethodInvokerRewriter actually manages a portion of the .slcache - it keeps track of two things:

The cache is for types that are *only* getting reflection interception done, not for types touching anything reloadable.

Since:
0.5.0

Constructor Summary
MethodInvokerRewriter()
           
 
Method Summary
static byte[] rewrite(TypeRegistry typeRegistry, byte[] bytes)
           
static byte[] rewrite(TypeRegistry typeRegistry, byte[] bytes, boolean skipReferencesCheck)
          Rewrite regular operations on reloadable types and any reflective calls.
static byte[] rewriteUsingCache(java.lang.String slashedClassName, TypeRegistry typeRegistry, byte[] bytes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvokerRewriter

public MethodInvokerRewriter()
Method Detail

rewrite

public static byte[] rewrite(TypeRegistry typeRegistry,
                             byte[] bytes,
                             boolean skipReferencesCheck)
Rewrite regular operations on reloadable types and any reflective calls.

Note: no caching is done here (the cache is not read or written to)

Parameters:
typeRegistry - the registry for which the rewriting is being done.
bytes - the bytes for the type to modify.
skipReferencesCheck - do we need to do a quick check to see if there is anything worth rewriting?
Returns:
the modified bytes.

rewrite

public static byte[] rewrite(TypeRegistry typeRegistry,
                             byte[] bytes)

rewriteUsingCache

public static byte[] rewriteUsingCache(java.lang.String slashedClassName,
                                       TypeRegistry typeRegistry,
                                       byte[] bytes)