Skip to content

Commit

Permalink
fix retrofit 1, 2 java sample
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Apr 28, 2016
1 parent 83be945 commit e7c9285
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}}
*/
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{{name}}}({{{value}}}){{^-last}},

{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
*/
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{{name}}}({{{value}}}){{^-last}},

{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}

{{>libraries/okhttp-gson/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}

{{>libraries/okhttp-gson/modelInnerEnum}}{{/items}}{{/items.isEnum}}
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
@SerializedName("{{baseName}}")
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
{{/vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}

{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}

{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
@SerializedName("{{baseName}}")
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
{{/vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}

{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}

{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
@SerializedName("{{baseName}}")
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
{{/vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class Pair {
private String name = "";
private String value = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00")
public class OAuth implements Authentication {
private String accessToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:51:06.629+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:10:49.444+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,30 @@ public class Order {
private Date shipDate = null;


public enum StatusEnum {
@SerializedName(""placed"")
PLACED(""placed""),
/**
* Order Status
*/
public enum StatusEnum {
@SerializedName("placed")
PLACED("placed"),

@SerializedName(""approved"")
APPROVED(""approved""),
@SerializedName("approved")
APPROVED("approved"),

@SerializedName(""delivered"")
DELIVERED(""delivered"");
@SerializedName("delivered")
DELIVERED("delivered");

private String value;
private String value;

StatusEnum(String value) {
this.value = value;
}
StatusEnum(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
@Override
public String toString() {
return String.valueOf(value);
}
}
}

@SerializedName("status")
private StatusEnum status = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,30 @@ public class Pet {
private List<Tag> tags = new ArrayList<Tag>();


public enum StatusEnum {
@SerializedName(""available"")
AVAILABLE(""available""),
/**
* pet status in the store
*/
public enum StatusEnum {
@SerializedName("available")
AVAILABLE("available"),

@SerializedName(""pending"")
PENDING(""pending""),
@SerializedName("pending")
PENDING("pending"),

@SerializedName(""sold"")
SOLD(""sold"");
@SerializedName("sold")
SOLD("sold");

private String value;
private String value;

StatusEnum(String value) {
this.value = value;
}
StatusEnum(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
@Override
public String toString() {
return String.valueOf(value);
}
}
}

@SerializedName("status")
private StatusEnum status = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T00:22:56.942+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:12:35.075+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,30 @@ public class Order {
private Date shipDate = null;


public enum StatusEnum {
@SerializedName(""placed"")
PLACED(""placed""),
/**
* Order Status
*/
public enum StatusEnum {
@SerializedName("placed")
PLACED("placed"),

@SerializedName(""approved"")
APPROVED(""approved""),
@SerializedName("approved")
APPROVED("approved"),

@SerializedName(""delivered"")
DELIVERED(""delivered"");
@SerializedName("delivered")
DELIVERED("delivered");

private String value;
private String value;

StatusEnum(String value) {
this.value = value;
}
StatusEnum(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
@Override
public String toString() {
return String.valueOf(value);
}
}
}

@SerializedName("status")
private StatusEnum status = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,30 @@ public class Pet {
private List<Tag> tags = new ArrayList<Tag>();


public enum StatusEnum {
@SerializedName(""available"")
AVAILABLE(""available""),
/**
* pet status in the store
*/
public enum StatusEnum {
@SerializedName("available")
AVAILABLE("available"),

@SerializedName(""pending"")
PENDING(""pending""),
@SerializedName("pending")
PENDING("pending"),

@SerializedName(""sold"")
SOLD(""sold"");
@SerializedName("sold")
SOLD("sold");

private String value;
private String value;

StatusEnum(String value) {
this.value = value;
}
StatusEnum(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
@Override
public String toString() {
return String.valueOf(value);
}
}
}

@SerializedName("status")
private StatusEnum status = null;
Expand Down

0 comments on commit e7c9285

Please sign in to comment.