jef.injection.impl
Class DefaultInjector

java.lang.Object
  extended by jef.injection.impl.DefaultInjector
All Implemented Interfaces:
Injector

public class DefaultInjector
extends java.lang.Object
implements Injector

Default implementation of the Injector interface. This implementation is thread-safe, so it can be used as a singleton thus reducing memory consumption.

Author:
Francesco Russo (frusso@dev.java.net)

Field Summary
protected static Logger logger
           
 
Constructor Summary
DefaultInjector()
          Creates a new instance of DefaultInjector
 
Method Summary
 void inject(Dna dstDna, DisconnectedMethod dm)
          This method injects a disconnected method into a destination DNA.
protected  void processInnerClasses(java.util.HashMap<java.lang.String,Dna> innerClasses, java.lang.String newFqn)
           
protected  void updateConstantClassInfoRefs(ConstantPoolTable cpt, java.lang.String fqClassName, java.lang.String newFqn)
          This method reorganizes the given constant pool table in a way that all the Constant Class Info structures pointing to a Constant UTF8 entry having a value equal to fqClassName, will point to the constant pool table entry specified by the third input parameter newFqnIndx.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static Logger logger
Constructor Detail

DefaultInjector

public DefaultInjector()
Creates a new instance of DefaultInjector

Method Detail

inject

public void inject(Dna dstDna,
                   DisconnectedMethod dm)
            throws InjectionException
Description copied from interface: Injector
This method injects a disconnected method into a destination DNA.

Specified by:
inject in interface Injector
Throws:
InjectionException

updateConstantClassInfoRefs

protected void updateConstantClassInfoRefs(ConstantPoolTable cpt,
                                           java.lang.String fqClassName,
                                           java.lang.String newFqn)
                                    throws WrongReferenceInConstantPoolTableException
This method reorganizes the given constant pool table in a way that all the Constant Class Info structures pointing to a Constant UTF8 entry having a value equal to fqClassName, will point to the constant pool table entry specified by the third input parameter newFqnIndx.

Parameters:
cpt - The constant pool table to work with
fqClassName - The old fully qualified name we want to look for and replace
newFqnIndx - The index of the new ConstantUTF8 entry in the given cpt, containing the new FQN we want to point to
Throws:
WrongReferenceInConstantPoolTableException

processInnerClasses

protected void processInnerClasses(java.util.HashMap<java.lang.String,Dna> innerClasses,
                                   java.lang.String newFqn)
                            throws WrongReferenceInConstantPoolTableException,
                                   DnaSerializationException,
                                   MissingDnaContainerException
Throws:
WrongReferenceInConstantPoolTableException
DnaSerializationException
MissingDnaContainerException