Skip to content

Commit

Permalink
fix toBundle logic in apiGen.
Browse files Browse the repository at this point in the history
  • Loading branch information
deepueg authored and krunalsshah committed Sep 14, 2018
1 parent caa6aed commit d3df8e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -154,16 +154,16 @@ public class {{requestDataType}} implements Parcelable, Bridgeable {
{{/isListContainer}}
{{^isListContainer}}
{{#isString}}
this.{{baseName}} = bundle.getString("{{baseName}}");
bundle.putString("{{baseName}}", this.{{baseName}});
{{/isString}}
{{#isInteger}}
this.{{baseName}} = getNumberValue(bundle, "{{baseName}}") == null ? null : getNumberValue(bundle, "{{baseName}}").intValue();
bundle.putInt("{{baseName}}", this.{{baseName}});
{{/isInteger}}
{{#isBoolean}}
this.{{baseName}} = bundle.containsKey("{{baseName}}") ? bundle.getBoolean("{{baseName}}") : null;
bundle.putBoolean("{{baseName}}", this.{{baseName}});
{{/isBoolean}}
{{^isPrimitiveType}}
this.{{baseName}} = bundle.containsKey("{{baseName}}") ? new {{{dataType}}}(bundle.getBundle("{{baseName}}")) : null;
bundle.putBundle("{{baseName}}", this.{{baseName}}.toBundle());
{{/isPrimitiveType}}
{{/isListContainer}}
{{/requiredParams}}
Expand All @@ -176,22 +176,22 @@ public class {{requestDataType}} implements Parcelable, Bridgeable {
{{^isListContainer}}
{{#isString}}
if({{baseName}} != null) {
this.{{baseName}} = bundle.getString("{{baseName}}");
bundle.putString("{{baseName}}", this.{{baseName}} );
}
{{/isString}}
{{#isInteger}}
if({{baseName}} != null) {
this.{{baseName}} = getNumberValue(bundle, "{{baseName}}") == null ? null : getNumberValue(bundle, "{{baseName}}").intValue();
bundle.putInt("{{baseName}}", this.{{baseName}});
}
{{/isInteger}}
{{#isBoolean}}
if({{baseName}} != null) {
this.{{baseName}} = bundle.containsKey("{{baseName}}") ? bundle.getBoolean("{{baseName}}") : null;
bundle.putBoolean("{{baseName}}", this.{{baseName}});
}
{{/isBoolean}}
{{^isPrimitiveType}}
if({{baseName}} != null) {
this.{{baseName}} = bundle.containsKey("{{baseName}}") ? new {{{dataType}}}(bundle.getBundle("{{baseName}}")) : null;
bundle.putBundle("{{baseName}}", this.{{baseName}}.toBundle());
}
{{/isPrimitiveType}}
{{/isListContainer}}
Expand Down
Expand Up @@ -97,8 +97,8 @@ public void writeToParcel(Parcel dest, int flags) {
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
this.key1 = bundle.getString("key1");
this.key2 = getNumberValue(bundle, "key2") == null ? null : getNumberValue(bundle, "key2").intValue();
bundle.putString("key1", this.key1);
bundle.putInt("key2", this.key2);
return bundle;
}

Expand Down

0 comments on commit d3df8e9

Please sign in to comment.