-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring. Adding new fields to DB model is easier.
* DB field constants are added in-order with previously added constants. Only missing and different fields are added. * If method exists, the new one is added right after the previous one to make manual merge easier and keep git diff short.
- Loading branch information
Showing
5 changed files
with
172 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/net/phonex/intellij/android/dbmodel/util/FieldDef.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package net.phonex.intellij.android.dbmodel.util; | ||
|
||
import com.intellij.psi.PsiField; | ||
|
||
/** | ||
* Created by dusanklinec on 08.03.15. | ||
*/ | ||
public class FieldDef { | ||
public String name; | ||
public String initializer; | ||
public PsiField field; | ||
|
||
public FieldDef(String name, String initializer, PsiField field) { | ||
this.name = name; | ||
this.initializer = initializer; | ||
this.field = field; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "FieldDef{" + | ||
"name='" + name + '\'' + | ||
", initializer='" + initializer + '\'' + | ||
", field=" + field + | ||
'}'; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/net/phonex/intellij/android/dbmodel/util/NewFieldRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package net.phonex.intellij.android.dbmodel.util; | ||
|
||
/** | ||
* Created by dusanklinec on 08.03.15. | ||
*/ | ||
public class NewFieldRecord { | ||
public String decl; | ||
public final String name; | ||
public final String value; | ||
public String comment; | ||
|
||
public NewFieldRecord(String name, String value) { | ||
this.name = name; | ||
this.value = value; | ||
setup(); | ||
} | ||
|
||
public NewFieldRecord(String name, String value, String comment) { | ||
this.value = value; | ||
this.name = name; | ||
this.comment = comment; | ||
setup(); | ||
} | ||
|
||
public void setup(){ | ||
this.decl = "extern NSString * " + name + "; \n"; | ||
if (comment == null) { | ||
this.decl = "public static final String "+name+" = \""+value+"\";\n"; | ||
} else { | ||
this.decl = "public static final String "+name+" = \""+value+"\"; //" + comment + "\n"; | ||
} | ||
} | ||
|
||
public void addComment(String s) { | ||
if (this.comment == null){ | ||
this.comment = s; | ||
} else { | ||
this.comment = this.comment + "; " + s; | ||
} | ||
|
||
setup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters