code: private static <T, ID, I extends GenericDAO<T, ID>> Class<? extends I> completeDAO(Class<T> modelClass,
                                                                                         Class<I> daoInterface,
                                                                                         Class<? extends QueryModelDAO<T, ID>> partialDAOClass,
                                                                                         boolean accessControlEnabled,
                                                                                         boolean metricsEnabled) {
          try {
              ClassPool pool = ClassPool.getDefault();
  
              pool.insertClassPath(new ClassClassPath(daoInterface));
  
              CtClass fullDAOCtClass = pool.makeClass(String.format("%s$%d", daoInterface.getName(), count.incrementAndGet()));
              CtClass partialDAOCtClass = pool.get(partialDAOClass.getName());
              CtClass daoInterfaceCtClass = pool.get(daoInterface.getName());
  
              fullDAOCtClass.setSuperclass(partialDAOCtClass);
              fullDAOCtClass.addInterface(daoInterfaceCtClass);
  
              buildConstructor(fullDAOCtClass, accessControlEnabled);
              buildNeededMethods(fullDAOCtClass, partialDAOCtClass, daoInterfaceCtClass, modelClass, accessControlEnabled, metricsEnabled);
  
              return ClassLoadingUtil.toClass(fullDAOCtClass);
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: -------------------------------------------------------------