memtrip / SQLKing

SQLKing is an Android SQLite ORM powered by an annotation preprocessor, tables are defined by Table annotations and CRUD classes expose an expressive api for executing SQLite queries. @memtrip
Other
21 stars 9 forks source link

Request for ability to ignore private static member variables in a Table #4

Closed Trellian closed 8 years ago

Trellian commented 8 years ago

Hi Sam,

I would like to be able to either ignore static members, or specifically to ignore one called "CREATOR".

This would allow for adding parcelable implementation to a Table.

Would this be possible?

I think it could be done without too much trouble, as follows in Column.Java:

` private List assembleMembers(Element element) { List columns = new ArrayList<>();

    if (element.getEnclosedElements() != null && element.getEnclosedElements().size() > 0) {
        for (Element childElement : element.getEnclosedElements()) {
            if (childElement.getKind().isField()) {
                **if (!childElement.getSimpleName().toString().equals("CREATOR")) {**
                    columns.add(new Column(childElement));
                }
            }
        }
    }

    return columns;
}`
Trellian commented 8 years ago

Apologies, Table.java

samkirton commented 8 years ago

I think it would be better to check if childElement is annotated with @Column? That way it would ignore all other members. You can make the change and raise a pull request if you want? Otherwise I can add this later.

samkirton commented 8 years ago

Fixed in https://github.com/memtrip/SQLKing/pull/5 and merged with master