dkulp commented on issue #561: [CXF-8053] portable feature to avoid jaxws for 
jaxrs apps
URL: https://github.com/apache/cxf/pull/561#issuecomment-498837564
 
 
   I'm wondering if it would make sense to insert a layer between 
AbstractFeature and the actual features like:  
   ```
   public abstract class AbstractDelegatingFeature<T extends 
AbstractPortableFeature> extends AbstractFeature {
       protected final T delegate;
       
       protected  AbstractDelegatingFeature(T d) {
           delegate = d;
       }
       
       @Override
       public void initialize(Server server, Bus bus) {
           delegate.initialize(server, bus);
       }
   
       @Override
       public void initialize(Client client, Bus bus) {
           delegate.initialize(client, bus);
       }
   
       @Override
       public void initialize(InterceptorProvider interceptorProvider, Bus bus) 
{
           delegate.initialize(interceptorProvider, bus);
       }
   
       @Override
       public void initialize(Bus bus) {
           delegate.initialize(bus);
       }
   
       @Override
       protected void initializeProvider(InterceptorProvider 
interceptorProvider, Bus bus) {
           delegate.doInitializeProvider(interceptorProvider, bus);
       }
   
   }
   ```
   
   and then each of the subclasses would look something like:
   ```
   public class GZIPFeature extends 
AbstractDelegatingFeature<GZIPFeature.Portable> {
       public GZIPFeature() {
           super(new Portable());
       }
   ...
   }
   ```
   
   and a lot of the duplicate code in each of the subclasses goes away. 
   
   Thoughts?
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to