Framework to simplify code for ODocumentWrappers and other DAO
PhantomYdn opened this issue · comments
Ilia Naryzhny commented
Will be cool to have something like:
@ProvidedBy(ODocumentWrapperProvider.class)
public interface IOPerspective extends IODocumentWrapper {
public String getAlias();
public Map<String, Object> getName();
default public String getTestAlias() {
return "test"+getAlias();
}
default public String getTest2Alias() {
return "test2"+getDocument().field("alias");
}
default public String getTest3Alias() {
return "test3"+getTestAlias();
}
@Lookup("select from OPerspective where alias = :alias")
public void lookup(String alias);
@Query("select expand(menu) from OPerspective where @rid = :target")
public List<ODocument> listAllMenu();
public List<ODocument> getMenu();
}
and
@ProvidedBy(DAOProvider.class)
public interface ITestDAO {
@Query("select from OPerspective")
public List<ODocument> listOPerspective();
default public int countPerspectives() {
return listOPerspective().size();
}
}