Skip to content

Commit

Permalink
fix enum for jaxrs and resteasy
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Apr 28, 2016
1 parent a184967 commit 9aa4ae9
Show file tree
Hide file tree
Showing 21 changed files with 135 additions and 111 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
/**
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
*/
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}({{{value}}}){{^-last}},

public enum {{{datatypeWithEnum}}} {
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/-last}}{{#-last}};
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
private {{datatype}} value;

private String value;

{{{datatypeWithEnum}}}(String value) {
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
this.value = value;
}

@Override
@JsonValue
public String toString() {
return value;
return String.valueOf(value);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
/**
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
*/
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}({{{value}}}){{^-last}},

public enum {{{datatypeWithEnum}}} {
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/-last}}{{#-last}};
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
private {{datatype}} value;

private String value;

{{{datatypeWithEnum}}}(String value) {
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
this.value = value;
}

@Override
@JsonValue
public String toString() {
return value;
return String.valueOf(value);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.api;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class ApiOriginFilter implements javax.servlet.Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlTransient;

@javax.xml.bind.annotation.XmlRootElement
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.api;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Path("/pet")


@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public abstract class PetApiService {
public abstract Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Path("/store")


@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class StoreApi {
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public abstract class StoreApiService {
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.api;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+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 @@ -20,7 +20,7 @@
@Path("/user")


@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class UserApi {
private final UserApiService delegate = UserApiServiceFactory.getUserApi();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public abstract class UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext)
throws NotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class Category {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class ModelApiResponse {

private Integer code = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class Order {

private Long id = null;
private Long petId = null;
private Integer quantity = null;
private Date shipDate = null;


/**
* Order Status
*/
public enum StatusEnum {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");

APPROVED("approved"),

DELIVERED("delivered");
private String value;

StatusEnum(String value) {
Expand All @@ -32,7 +35,7 @@ public enum StatusEnum {
@Override
@JsonValue
public String toString() {
return value;
return String.valueOf(value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class Pet {

private Long id = null;
Expand All @@ -20,12 +20,15 @@ public class Pet {
private List<String> photoUrls = new ArrayList<String>();
private List<Tag> tags = new ArrayList<Tag>();


/**
* pet status in the store
*/
public enum StatusEnum {
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");

PENDING("pending"),

SOLD("sold");
private String value;

StatusEnum(String value) {
Expand All @@ -35,7 +38,7 @@ public enum StatusEnum {
@Override
@JsonValue
public String toString() {
return value;
return String.valueOf(value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class Tag {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00")
public class User {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ public class Order {
private Integer quantity = null;
private Date shipDate = null;


/**
* Order Status
*/
public enum StatusEnum {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");

APPROVED("approved"),

DELIVERED("delivered");
private String value;

StatusEnum(String value) {
Expand All @@ -34,7 +37,7 @@ public enum StatusEnum {
@Override
@JsonValue
public String toString() {
return value;
return String.valueOf(value);
}
}

Expand Down
Loading

0 comments on commit 9aa4ae9

Please sign in to comment.