mediarain / RoboCoP

Pure Java code generation tool for generating a fully functional ContentProvider for Android.
246 stars 24 forks source link

Boolean data type #7

Open JeremiahStephenson opened 10 years ago

JeremiahStephenson commented 10 years ago

When defining a boolean type in the schema the generated class file has a build error. In the constructor for the class something like this is generated:

setSomeBoolean(cursor.getInt(cursor.getColumnIndex(prefix + DummyTable.SOME_BOOLEAN)));

This of course causes a build error because it is trying to set an int as a boolean. Below should be the correct output:

setSomeBoolean(!cursor.isNull(cursor.getColumnIndex(prefix + DummyTable.SOME_BOOLEAN)) && 
                cursor.getInt(cursor.getColumnIndex(prefix + DummyTable.SOME_BOOLEAN)) == 1);