You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2019/06/04 20:47:43 UTC

[GitHub] [cxf] dkulp commented on issue #561: [CXF-8053] portable feature to avoid jaxws for jaxrs apps

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:
users@infra.apache.org


With regards,
Apache Git Services