Skip to content

Commit

Permalink
Merge pull request #12 from zeoflow/feature/built_in_getter
Browse files Browse the repository at this point in the history
Added recogniser for getter methods that contain uppercase instead of '_'
  • Loading branch information
teogor authored Jan 15, 2022
2 parents 98fc64d + a669c10 commit f62aaf9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/com/zeoflow/depot/db/Word.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ public class Word
@ColumnInfo(name = "word")
private final String mWord;

private final Date date;
private final Date date_s;

public Word(@NonNull String mWord, Date date) {
public Word(@NonNull String mWord, Date date_s) {
this.mWord = mWord;
this.date = date;
this.date_s = date_s;
}

@com.zeoflow.depot.Ignore
public Word(@NonNull String word)
{
this.mWord = word;
this.date = new Date();
this.date_s = new Date();
}

@NonNull
Expand All @@ -64,8 +64,8 @@ public String getWord()
return this.mWord;
}

public Date getDate() {
return date;
public Date getDateS() {
return date_s;
}

}
13 changes: 13 additions & 0 deletions compiler/src/main/kotlin/com/zeoflow/depot/vo/Field.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ data class Field(
result.add(name.substring(1).decapitalize(Locale.US))
}

if (name.contains('_')) {
val nameSplits = name.split('_')
var nameFinal = ""
for (nameSplit in nameSplits) {
if (nameFinal == "") {
nameFinal = nameSplit
} else {
nameFinal += nameSplit.capitalize(Locale.US)
}
}
result.add(nameFinal)
}

if (typeName == TypeName.BOOLEAN || typeName == TypeName.BOOLEAN.box()) {
if (name.length > 2 && name.startsWith("is") && name[2].isUpperCase()) {
result.add(name.substring(2).decapitalize(Locale.US))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public AtomAnnotatedClass(
}
}
}
System.out.println("converters added");
}
}

Expand Down

0 comments on commit f62aaf9

Please sign in to comment.