Commit 28969573 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added method to get interface instance with default values

parent adf701b9
......@@ -9,8 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure.tosca.client;
......@@ -23,12 +21,15 @@ import java.util.List;
* @param <T> The return type
*/
public interface ApiCallback<T> {
/**
* This is called when the API call fails.
*
* @param e The exception causing the failure
* @param statusCode Status code of the response if available, otherwise it would be 0
* @param responseHeaders Headers of the response if available, otherwise it would be null
* @param statusCode Status code of the response if available, otherwise it
* would be 0
* @param responseHeaders Headers of the response if available, otherwise it
* would be null
*/
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);
......
......@@ -9,20 +9,20 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure.tosca.client;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;
public ApiException() {}
public ApiException() {
}
public ApiException(Throwable throwable) {
super(throwable);
......
......@@ -9,8 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure.tosca.client;
import java.util.List;
......@@ -22,6 +20,7 @@ import java.util.Map;
* @param <T> The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
......
......@@ -9,12 +9,11 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();
/**
......
......@@ -9,6 +9,8 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure.tosca.client;
import com.google.gson.Gson;
......@@ -23,7 +25,7 @@ import io.gsonfire.GsonFireBuilder;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.format.DateTimeFormatter;
;
import okio.ByteString;
import java.io.IOException;
......@@ -35,10 +37,7 @@ import java.text.ParsePosition;
import java.util.Date;
import java.util.Map;
public class JSON {
private Gson gson;
private boolean isLenientOnJson = false;
private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
......@@ -48,14 +47,15 @@ public class JSON {
private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder();
GsonFireBuilder fireBuilder = new GsonFireBuilder()
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;
}
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
if (null == element) {
if(null == element) {
throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
}
return element.getAsString();
......@@ -63,7 +63,7 @@ public class JSON {
private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase());
if (null == clazz) {
if(null == clazz) {
throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
}
return clazz;
......@@ -136,11 +136,9 @@ public class JSON {
} catch (JsonParseException e) {
// Fallback processing when failed to parse JSON form response body:
// return the response body string directly for the String return type;
if (returnType.equals(String.class)) {
if (returnType.equals(String.class))
return (T) body;
} else {
throw (e);
}
else throw (e);
}
}
......@@ -209,7 +207,7 @@ public class JSON {
default:
String date = in.nextString();
if (date.endsWith("+0000")) {
date = date.substring(0, date.length() - 5) + "Z";
date = date.substring(0, date.length()-5) + "Z";
}
return OffsetDateTime.parse(date, formatter);
}
......@@ -268,9 +266,9 @@ public class JSON {
}
/**
* Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a
* simple "yyyy-MM-dd" format will be used (more efficient than
* SimpleDateFormat).
* Gson TypeAdapter for java.sql.Date type
* If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
* (more efficient than SimpleDateFormat).
*/
public static class SqlDateTypeAdapter extends TypeAdapter<java.sql.Date> {
......@@ -323,8 +321,8 @@ public class JSON {
}
/**
* Gson TypeAdapter for java.util.Date type If the dateFormat is null,
* ISO8601Utils will be used.
* Gson TypeAdapter for java.util.Date type
* If the dateFormat is null, ISO8601Utils will be used.
*/
public static class DateTypeAdapter extends TypeAdapter<Date> {
......
......@@ -13,7 +13,7 @@
package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class Pair {
private String name = "";
private String value = "";
......
......@@ -13,7 +13,7 @@
package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment