I have this interface:
public interface IDbTable extends Serializable
{
public int getId();
}
I need to obligate all the classes that implements IDbTable, to have an annotation "@DatabaseTable" and at least one field inside class that have "@DatabaseField". The only way of implementing IDbTable needs to be like this:
@DatabaseTable(tableName = "Something")
public static class TestTable implements IDbTable
{
@DatabaseField
public int id;
public int getId()
{
return id;
}
}
Is this possible with interface or inheritance? Today i have an unit test that scan all the classes and check this requirements. Is this a good practice?