ClassTransformation.addInitialization()
---------------------------------------

                 Key: TAP5-852
                 URL: https://issues.apache.org/jira/browse/TAP5-852
             Project: Tapestry 5
          Issue Type: New Feature
          Components: tapestry-core
            Reporter: Howard M. Lewis Ship


It is very common to want to add some initialization to a component.

Currently, it is necessary to inject dependencies and directly add code.

It would be nice if there were new interfaces:

interface ComponentInitializer {
  void initializeComponent(ComponentResources resources);
}

interface ComponentFieldInitializer {
  Object initializeComponentField(ComponentResources resources);
}

These could be paired up with methods in ClassTransformation:

void addFieldInitialization(String fieldName, ComponentFieldInitializer 
initializer);
void addInitialization(ComponentInitializer initializer);

These methods would translate to code executed in the constructor of the 
component.

This would simplify many of the existing component class transform workers.

It also represents a way to start moving away from writing explicit code 
generation (using Javassist psuedo-code) towards a more API driven approach 
that could eventually be implemented using
ASM or some other better supported toolkit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to