Search code examples
javaoopinterfacearchitectureclean-architecture

Clean architecture practice for my Java project


I would like to ask, if you have any idea, to make the architecture of my Java project cleaner.

  abstract class rdfDataChecker {
    List<T> data;
    // all abstract methods to check data... more than 20 methods. They all use the list "data". 
    }

    // the idea of this interface is, that all the data loaders can just use feedable.feed(List<T>). (we inject this dataChecker to the data Loader).
    interface Feedable {
    void feed(List<T>);
    }

   //implementations in different java frameworks.
    class specificRdfDataChecker extends rdfDataChecker implements Feedable{
    // implement all the methods.
    }


   class DataLoader {
   private Feedable feedable;
   public DataLoader(Feedable feedable) { 
   this.feedable = feedable;
   }
   }

Thank you in advance for your suggestions.


Solution

  • This pattern is a common and acceptable pattern - it is even used in the Java libraries. See ArrayList that extends AbstractList and implements List.