greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

[ Suggestion ] Allow specifying where to put generated code #478

Open codemaker1999 opened 8 years ago

codemaker1999 commented 8 years ago

Sometimes after building my project, some of the code in my entity class gets mixed in with the generated code, and I have to scroll through and copy paste things around (is there a reason for this behaviour?). Unless this is a bug, some people might find it handy to be able to tell greendao where to put generated code, maybe with an optional comment section like so:

@Entity
class Foo {
    @Id private Long bar;
    // GENERATED CODE

    // GENERATED CODE END
}

And for reference I'm using:

greendao-gradle-plugin 3.2.0
greendao 3.2.0
Android Studio 2.2.1
gradle 2.2.1
greenrobot-team commented 8 years ago

The Gradle plugin inserts code in a certain order (first fields, then constructors, then methods). It should add generated code after existing types of code (new fields after existing fields, ...).

But yes, there are issues. If you have a small example project to show what you would expect, we might be able to fix things.

Your suggestion remains valid still. -ut