pt.digitalis.dif.codegen.util
Class ClassEnhancerImpl

java.lang.Object
  extended by pt.digitalis.dif.codegen.util.ClassEnhancerImpl
All Implemented Interfaces:
IClassEnhancer

public class ClassEnhancerImpl
extends Object
implements IClassEnhancer

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
17 de Mar de 2011

Constructor Summary
ClassEnhancerImpl(IRegistrationManager registrationManager, IParameterManager parameterManager, IIdentityManager identityManager, IAuthorizationManager authorizationManager)
          Constructor.
 
Method Summary
 pt.digitalis.utils.bytecode.holders.ClassHolder enhance(pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
          Reads and iterates over the class annotations, processing them according to their target scope.
 void processAnnotation(ClassEnhancementContext classEnhancementContext, pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation, DEMAnnotationLogic annotationLogic)
          Processes a given type-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.
 void processAnnotation(ClassEnhancementContext classEnhancementContext, pt.digitalis.utils.bytecode.holders.AttributeHolder attribute, pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation, DEMAnnotationLogic annotationLogic)
          Processes a given field-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.
 void processAnnotation(ClassEnhancementContext classEnhancementContext, pt.digitalis.utils.bytecode.holders.MethodHolder method, pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation, DEMAnnotationLogic annotationLogic)
          Processes a given method-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassEnhancerImpl

public ClassEnhancerImpl(IRegistrationManager registrationManager,
                         IParameterManager parameterManager,
                         IIdentityManager identityManager,
                         IAuthorizationManager authorizationManager)
                  throws pt.digitalis.utils.bytecode.exceptions.CodeGenerationException
Constructor.

Parameters:
registrationManager - the registration manager instance
parameterManager - the parameter manager instance
identityManager - the identity manager instance
authorizationManager - the authorization manager instance
Throws:
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if the needed resources for class enhancement could not be properly initialized
Method Detail

enhance

public pt.digitalis.utils.bytecode.holders.ClassHolder enhance(pt.digitalis.utils.bytecode.holders.ClassHolder clazz)
                                                        throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                                                               pt.digitalis.utils.bytecode.exceptions.CodeGenerationException,
                                                               DIFCodeGenerationException
Reads and iterates over the class annotations, processing them according to their target scope.

Specified by:
enhance in interface IClassEnhancer
Parameters:
clazz - the class to enhance.
Returns:
the entity class for DEMRegistry addition
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if the class could not be loaded
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if class could not be enhanced
AnnotationMisuseException - if an inappropriate annotation use was made
DIFCodeGenerationException
See Also:
IClassEnhancer.enhance(ClassHolder)

processAnnotation

public void processAnnotation(ClassEnhancementContext classEnhancementContext,
                              pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation,
                              DEMAnnotationLogic annotationLogic)
                       throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                              pt.digitalis.utils.bytecode.exceptions.CodeGenerationException,
                              DIFCodeGenerationException
Description copied from interface: IClassEnhancer
Processes a given type-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.

Specified by:
processAnnotation in interface IClassEnhancer
Parameters:
classEnhancementContext - the class enhancement context
annotation - the annotation used to choose the appropriate code enhancement
annotationLogic - the annotationLogic class implementation
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if any need resource can't be found or loaded
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if source code can not be compiled or appended to class
DIFCodeGenerationException
See Also:
IClassEnhancer.processAnnotation(pt.digitalis.dif.codegen.util.ClassEnhancementContext, pt.digitalis.utils.bytecode.holders.AnnotationHolder, pt.digitalis.dif.dem.DEMAnnotationLogic)

processAnnotation

public void processAnnotation(ClassEnhancementContext classEnhancementContext,
                              pt.digitalis.utils.bytecode.holders.AttributeHolder attribute,
                              pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation,
                              DEMAnnotationLogic annotationLogic)
                       throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                              pt.digitalis.utils.bytecode.exceptions.CodeGenerationException,
                              DIFCodeGenerationException
Description copied from interface: IClassEnhancer
Processes a given field-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.

Specified by:
processAnnotation in interface IClassEnhancer
Parameters:
classEnhancementContext - the class enhancement context
attribute - annotated attribute
annotation - the annotation used to choose the appropriate code enhancement
annotationLogic - the annotationLogic class implementation
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if any need resource can't be found or loaded
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if source code can not be compiled or appended to class
DIFCodeGenerationException
See Also:
IClassEnhancer.processAnnotation(pt.digitalis.dif.codegen.util.ClassEnhancementContext, pt.digitalis.utils.bytecode.holders.AttributeHolder, pt.digitalis.utils.bytecode.holders.AnnotationHolder, pt.digitalis.dif.dem.DEMAnnotationLogic)

processAnnotation

public void processAnnotation(ClassEnhancementContext classEnhancementContext,
                              pt.digitalis.utils.bytecode.holders.MethodHolder method,
                              pt.digitalis.utils.bytecode.holders.AnnotationHolder annotation,
                              DEMAnnotationLogic annotationLogic)
                       throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException,
                              pt.digitalis.utils.bytecode.exceptions.CodeGenerationException,
                              DIFCodeGenerationException
Description copied from interface: IClassEnhancer
Processes a given method-targeted annotation, enhancing the class with bytecode generated accordingly to the annotation.

Specified by:
processAnnotation in interface IClassEnhancer
Parameters:
classEnhancementContext - the class enhancement context
method - annotated method
annotation - the annotation used to choose the appropriate code enhancement
annotationLogic - the annotationLogic class implementation
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if any need resource can't be found or loaded
pt.digitalis.utils.bytecode.exceptions.CodeGenerationException - if source code can not be compiled or appended to class
DIFCodeGenerationException
See Also:
IClassEnhancer.processAnnotation(pt.digitalis.dif.codegen.util.ClassEnhancementContext, pt.digitalis.utils.bytecode.holders.MethodHolder, pt.digitalis.utils.bytecode.holders.AnnotationHolder, pt.digitalis.dif.dem.DEMAnnotationLogic)


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