pt.digitalis.dif.codegen.util
Class ClassEnhancements

java.lang.Object
  extended by pt.digitalis.dif.codegen.util.ClassEnhancements

public class ClassEnhancements
extends Object

Defines a class enhancement object.

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt
Created on:
Dec 10, 2007

Constructor Summary
ClassEnhancements(pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Builds a class enhancements object from the class name.
 
Method Summary
 void addEnhancement(ClassMethodEnhancement enhancement)
          Adds a processed enhancement to the class.
 void addSource(String methodName, String methodSource)
          Adds a source to a given method.
 void commitEnhancements()
          Commits all the enhancements to a class file.
 String getClassName()
          Returns the class name.
 pt.digitalis.utils.bytecode.holders.ClassHolder getClassObject()
          Returns the class object.
 Map<String,ClassMethodEnhancement> getMethodEnhancements()
          Returns the method enhancements map.
 void registerMethodAsIncremental(String methodName)
          Adds a method name to the list of incremental methods.
 void setTerminator(String methodName, String terminator)
          Adds a source to a given method.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassEnhancements

public ClassEnhancements(pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
Builds a class enhancements object from the class name.

Parameters:
clazz - the class to be enhanced
Method Detail

addEnhancement

public void addEnhancement(ClassMethodEnhancement enhancement)
Adds a processed enhancement to the class.

Parameters:
enhancement - the enhancement to add

addSource

public void addSource(String methodName,
                      String methodSource)
Adds a source to a given method. Takes care of the incremental logic according to the registered methods.

Parameters:
methodName - the method name
methodSource - the method source

commitEnhancements

public void commitEnhancements()
                        throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                               pt.digitalis.utils.bytecode.exceptions.CodeGenerationException
Commits all the enhancements to a class file.

Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if the class can't be found
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if the code can't be compiled

getClassName

public String getClassName()
Returns the class name.

Returns:
the class name

getClassObject

public pt.digitalis.utils.bytecode.holders.ClassHolder getClassObject()
Returns the class object.

Returns:
the class object

getMethodEnhancements

public Map<String,ClassMethodEnhancement> getMethodEnhancements()
Returns the method enhancements map.

Returns:
the method enhancements map

registerMethodAsIncremental

public void registerMethodAsIncremental(String methodName)
Adds a method name to the list of incremental methods.

Parameters:
methodName - the name of the method to register

setTerminator

public void setTerminator(String methodName,
                          String terminator)
Adds a source to a given method. Takes care of the incremental logic according to the registered methods.

Parameters:
methodName - the method name
terminator - the finalize code for the method

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.