package act.di.guice;

import act.app.DbServiceManager;
import act.db.DB;

public abstract class DaoInjectionListenerBase implements DaoInjectionListener {

    private Class<?> modelType;
    private String dbSvcId = DbServiceManager.DEFAULT;

    @Override
    public void modelType(Class<?> modelType) {
        this.modelType = modelType;
        DB db = modelType.getDeclaredAnnotation(DB.class);
        if (null != db) {
            dbSvcId = db.value();
        }
    }

    protected String svcId() {
        return dbSvcId;
    }

    protected Class<?> modelType() {
        return modelType;
    }
}

@@ -68,16 +68,57 @@
 db.DB;%0A%0A
+import java.lang.annotation.Annotation;%0A%0A
 public a
@@ -397,22 +397,9 @@
 b = 
-modelType.getD
+d
 ecla
@@ -412,16 +412,27 @@
 otation(
+modelType, 
 DB.class
@@ -606,24 +606,24 @@
 delType() %7B%0A
-
         retu
@@ -641,11 +641,372 @@
 e;%0A    %7D
+%0A%0A    private %3CT extends Annotation%3E T declaredAnnotation(Class c, Class%3CT%3E annoClass) %7B%0A        Annotation%5B%5D aa = c.getDeclaredAnnotations();%0A        if (null == aa) %7B%0A            return null;%0A        %7D%0A        for (Annotation a : aa) %7B%0A            if (annoClass.isInstance(a)) %7B%0A                return (T) a;%0A            %7D%0A        %7D%0A        return null;%0A    %7D
 %0A%7D%0A

remove java8 dependency