Skip to content

Commit

Permalink
fixed compile issues with private model container class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Grosner committed Jul 3, 2015
1 parent efb2e42 commit c7609d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,11 @@ public void writeToModelDefinition(JavaWriter javaWriter, boolean isModelContain
AdapterQueryBuilder queryBuilder = new AdapterQueryBuilder();
queryBuilder.appendVariable(false)
.append(".")
.append(columnFieldName);
queryBuilder.appendSpaceSeparated("=");
.append(columnAccessModel.getSetterReferenceColumnFieldName());

if (!columnAccessModel.isPrivate()) {
queryBuilder.appendSpaceSeparated("=");
}

String getType = columnFieldType;
// Type converters can never be primitive except boolean
Expand All @@ -528,9 +531,20 @@ public void writeToModelDefinition(JavaWriter javaWriter, boolean isModelContain
.append(
".toModel())");
} else {
if (columnAccessModel.isRequiresTypeConverter() && !columnAccessModel.isEnum()) {
queryBuilder.appendTypeConverter(null, getType, true);
}
queryBuilder.append(String.format("value%1s)", columnFieldName));
}

if (columnAccessModel.isRequiresTypeConverter() && !columnAccessModel.isEnum()) {
queryBuilder.append(")");
}

if (columnAccessModel.isPrivate()) {
queryBuilder.append(")");
}

javaWriter.emitStatement(queryBuilder.getQuery());

if (!isModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ public boolean isPrivate() {
return isPrivate;
}

public boolean isEnum() {
return isEnum;
}

public boolean isRequiresTypeConverter() {
return requiresTypeConverter;
}

public String getQueryNoCast() {
return getQuery(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BoxedModel extends TestModel1 {
@Column
@PrimaryKey
@NotNull
Long id = 1L;
public Long id = 1L;

@Column
@NotNull
Expand Down

0 comments on commit c7609d2

Please sign in to comment.