Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
28969573
Commit
28969573
authored
Dec 28, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added method to get interface instance with default values
parent
adf701b9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
357 additions
and
40 deletions
+357
-40
ApiCallback.java
...n/java/nl/uva/sne/drip/sure/tosca/client/ApiCallback.java
+5
-4
ApiException.java
.../java/nl/uva/sne/drip/sure/tosca/client/ApiException.java
+4
-4
ApiResponse.java
...n/java/nl/uva/sne/drip/sure/tosca/client/ApiResponse.java
+1
-2
Configuration.java
...java/nl/uva/sne/drip/sure/tosca/client/Configuration.java
+2
-3
DefaultApi.java
...in/java/nl/uva/sne/drip/sure/tosca/client/DefaultApi.java
+320
-0
JSON.java
...src/main/java/nl/uva/sne/drip/sure/tosca/client/JSON.java
+23
-25
Pair.java
...src/main/java/nl/uva/sne/drip/sure/tosca/client/Pair.java
+1
-1
StringUtil.java
...in/java/nl/uva/sne/drip/sure/tosca/client/StringUtil.java
+1
-1
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/ApiCallback.java
View file @
28969573
...
...
@@ -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
);
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/ApiException.java
View file @
28969573
...
...
@@ -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-2
5T13:58:54.535
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
8T19:11:27.492
Z"
)
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
);
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/ApiResponse.java
View file @
28969573
...
...
@@ -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
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/Configuration.java
View file @
28969573
...
...
@@ -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-2
5T13:58:54.535
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
8T19:11:27.492
Z"
)
public
class
Configuration
{
private
static
ApiClient
defaultApiClient
=
new
ApiClient
();
/**
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/DefaultApi.java
View file @
28969573
...
...
@@ -478,6 +478,326 @@ public class DefaultApi {
return
call
;
}
/**
* Build call for getDefaultInterface
*
* @param id ID of topolog template uplodaed (required)
* @param interfaceType type to instantiate (required)
* @param instanceName the name of the instance to retrun (required)
* @param operationName the name of operation (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getDefaultInterfaceCall
(
String
id
,
String
interfaceType
,
String
instanceName
,
String
operationName
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
Object
localVarPostBody
=
null
;
// create path and map variables
String
localVarPath
=
"/tosca_template/{id}/interface/{interface_type}/default"
.
replaceAll
(
"\\{"
+
"id"
+
"\\}"
,
apiClient
.
escapeString
(
id
.
toString
()))
.
replaceAll
(
"\\{"
+
"interface_type"
+
"\\}"
,
apiClient
.
escapeString
(
interfaceType
.
toString
()));
List
<
Pair
>
localVarQueryParams
=
new
ArrayList
<
Pair
>();
List
<
Pair
>
localVarCollectionQueryParams
=
new
ArrayList
<
Pair
>();
if
(
instanceName
!=
null
)
{
localVarQueryParams
.
addAll
(
apiClient
.
parameterToPair
(
"instance_name"
,
instanceName
));
}
if
(
operationName
!=
null
)
{
localVarQueryParams
.
addAll
(
apiClient
.
parameterToPair
(
"operation_name"
,
operationName
));
}
Map
<
String
,
String
>
localVarHeaderParams
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
Object
>
localVarFormParams
=
new
HashMap
<
String
,
Object
>();
final
String
[]
localVarAccepts
=
{
"application/json"
};
final
String
localVarAccept
=
apiClient
.
selectHeaderAccept
(
localVarAccepts
);
if
(
localVarAccept
!=
null
)
{
localVarHeaderParams
.
put
(
"Accept"
,
localVarAccept
);
}
final
String
[]
localVarContentTypes
=
{};
final
String
localVarContentType
=
apiClient
.
selectHeaderContentType
(
localVarContentTypes
);
localVarHeaderParams
.
put
(
"Content-Type"
,
localVarContentType
);
if
(
progressListener
!=
null
)
{
apiClient
.
getHttpClient
().
networkInterceptors
().
add
(
new
com
.
squareup
.
okhttp
.
Interceptor
()
{
@Override
public
com
.
squareup
.
okhttp
.
Response
intercept
(
com
.
squareup
.
okhttp
.
Interceptor
.
Chain
chain
)
throws
IOException
{
com
.
squareup
.
okhttp
.
Response
originalResponse
=
chain
.
proceed
(
chain
.
request
());
return
originalResponse
.
newBuilder
()
.
body
(
new
ProgressResponseBody
(
originalResponse
.
body
(),
progressListener
))
.
build
();
}
});
}
String
[]
localVarAuthNames
=
new
String
[]{};
return
apiClient
.
buildCall
(
localVarPath
,
"GET"
,
localVarQueryParams
,
localVarCollectionQueryParams
,
localVarPostBody
,
localVarHeaderParams
,
localVarFormParams
,
localVarAuthNames
,
progressRequestListener
);
}
@SuppressWarnings
(
"rawtypes"
)
private
com
.
squareup
.
okhttp
.
Call
getDefaultInterfaceValidateBeforeCall
(
String
id
,
String
interfaceType
,
String
instanceName
,
String
operationName
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
// verify the required parameter 'id' is set
if
(
id
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'id' when calling getDefaultInterface(Async)"
);
}
// verify the required parameter 'interfaceType' is set
if
(
interfaceType
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'interfaceType' when calling getDefaultInterface(Async)"
);
}
// verify the required parameter 'instanceName' is set
if
(
instanceName
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'instanceName' when calling getDefaultInterface(Async)"
);
}
// verify the required parameter 'operationName' is set
if
(
operationName
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'operationName' when calling getDefaultInterface(Async)"
);
}
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultInterfaceCall
(
id
,
interfaceType
,
instanceName
,
operationName
,
progressListener
,
progressRequestListener
);
return
call
;
}
/**
*
* returns an interface instance with the default required values.
*
* @param id ID of topolog template uplodaed (required)
* @param interfaceType type to instantiate (required)
* @param instanceName the name of the instance to retrun (required)
* @param operationName the name of operation (required)
* @return Map<String, Object>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
Map
<
String
,
Object
>
getDefaultInterface
(
String
id
,
String
interfaceType
,
String
instanceName
,
String
operationName
)
throws
ApiException
{
ApiResponse
<
Map
<
String
,
Object
>>
resp
=
getDefaultInterfaceWithHttpInfo
(
id
,
interfaceType
,
instanceName
,
operationName
);
return
resp
.
getData
();
}
/**
*
* returns an interface instance with the default required values.
*
* @param id ID of topolog template uplodaed (required)
* @param interfaceType type to instantiate (required)
* @param instanceName the name of the instance to retrun (required)
* @param operationName the name of operation (required)
* @return ApiResponse<Map<String, Object>>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
ApiResponse
<
Map
<
String
,
Object
>>
getDefaultInterfaceWithHttpInfo
(
String
id
,
String
interfaceType
,
String
instanceName
,
String
operationName
)
throws
ApiException
{
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultInterfaceValidateBeforeCall
(
id
,
interfaceType
,
instanceName
,
operationName
,
null
,
null
);
Type
localVarReturnType
=
new
TypeToken
<
Map
<
String
,
Object
>>()
{
}.
getType
();
return
apiClient
.
execute
(
call
,
localVarReturnType
);
}
/**
* (asynchronously) returns an interface instance with the default required
* values.
*
* @param id ID of topolog template uplodaed (required)
* @param interfaceType type to instantiate (required)
* @param instanceName the name of the instance to retrun (required)
* @param operationName the name of operation (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing
* the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getDefaultInterfaceAsync
(
String
id
,
String
interfaceType
,
String
instanceName
,
String
operationName
,
final
ApiCallback
<
Map
<
String
,
Object
>>
callback
)
throws
ApiException
{
ProgressResponseBody
.
ProgressListener
progressListener
=
null
;
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
=
null
;
if
(
callback
!=
null
)
{
progressListener
=
new
ProgressResponseBody
.
ProgressListener
()
{
@Override
public
void
update
(
long
bytesRead
,
long
contentLength
,
boolean
done
)
{
callback
.
onDownloadProgress
(
bytesRead
,
contentLength
,
done
);
}
};
progressRequestListener
=
new
ProgressRequestBody
.
ProgressRequestListener
()
{
@Override
public
void
onRequestProgress
(
long
bytesWritten
,
long
contentLength
,
boolean
done
)
{
callback
.
onUploadProgress
(
bytesWritten
,
contentLength
,
done
);
}
};
}
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultInterfaceValidateBeforeCall
(
id
,
interfaceType
,
instanceName
,
operationName
,
progressListener
,
progressRequestListener
);
Type
localVarReturnType
=
new
TypeToken
<
Map
<
String
,
Object
>>()
{
}.
getType
();
apiClient
.
executeAsync
(
call
,
localVarReturnType
,
callback
);
return
call
;
}
/**
* Build call for getDefaultNodeType
*
* @param id ID of topolog template uplodaed (required)
* @param nodeType type to instantiate (required)
* @param instanceName the name of tghe instance to retrun (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getDefaultNodeTypeCall
(
String
id
,
String
nodeType
,
String
instanceName
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
Object
localVarPostBody
=
null
;
// create path and map variables
String
localVarPath
=
"/tosca_template/{id}/node_types/{node_type}/default"
.
replaceAll
(
"\\{"
+
"id"
+
"\\}"
,
apiClient
.
escapeString
(
id
.
toString
()))
.
replaceAll
(
"\\{"
+
"node_type"
+
"\\}"
,
apiClient
.
escapeString
(
nodeType
.
toString
()));
List
<
Pair
>
localVarQueryParams
=
new
ArrayList
<
Pair
>();
List
<
Pair
>
localVarCollectionQueryParams
=
new
ArrayList
<
Pair
>();
if
(
instanceName
!=
null
)
{
localVarQueryParams
.
addAll
(
apiClient
.
parameterToPair
(
"instance_name"
,
instanceName
));
}
Map
<
String
,
String
>
localVarHeaderParams
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
Object
>
localVarFormParams
=
new
HashMap
<
String
,
Object
>();
final
String
[]
localVarAccepts
=
{
"application/json"
};
final
String
localVarAccept
=
apiClient
.
selectHeaderAccept
(
localVarAccepts
);
if
(
localVarAccept
!=
null
)
{
localVarHeaderParams
.
put
(
"Accept"
,
localVarAccept
);
}
final
String
[]
localVarContentTypes
=
{};
final
String
localVarContentType
=
apiClient
.
selectHeaderContentType
(
localVarContentTypes
);
localVarHeaderParams
.
put
(
"Content-Type"
,
localVarContentType
);
if
(
progressListener
!=
null
)
{
apiClient
.
getHttpClient
().
networkInterceptors
().
add
(
new
com
.
squareup
.
okhttp
.
Interceptor
()
{
@Override
public
com
.
squareup
.
okhttp
.
Response
intercept
(
com
.
squareup
.
okhttp
.
Interceptor
.
Chain
chain
)
throws
IOException
{
com
.
squareup
.
okhttp
.
Response
originalResponse
=
chain
.
proceed
(
chain
.
request
());
return
originalResponse
.
newBuilder
()
.
body
(
new
ProgressResponseBody
(
originalResponse
.
body
(),
progressListener
))
.
build
();
}
});
}
String
[]
localVarAuthNames
=
new
String
[]{};
return
apiClient
.
buildCall
(
localVarPath
,
"GET"
,
localVarQueryParams
,
localVarCollectionQueryParams
,
localVarPostBody
,
localVarHeaderParams
,
localVarFormParams
,
localVarAuthNames
,
progressRequestListener
);
}
@SuppressWarnings
(
"rawtypes"
)
private
com
.
squareup
.
okhttp
.
Call
getDefaultNodeTypeValidateBeforeCall
(
String
id
,
String
nodeType
,
String
instanceName
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
// verify the required parameter 'id' is set
if
(
id
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'id' when calling getDefaultNodeType(Async)"
);
}
// verify the required parameter 'nodeType' is set
if
(
nodeType
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'nodeType' when calling getDefaultNodeType(Async)"
);
}
// verify the required parameter 'instanceName' is set
if
(
instanceName
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'instanceName' when calling getDefaultNodeType(Async)"
);
}
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultNodeTypeCall
(
id
,
nodeType
,
instanceName
,
progressListener
,
progressRequestListener
);
return
call
;
}
/**
*
* returns an node templaye instance with the default required values.
*
* @param id ID of topolog template uplodaed (required)
* @param nodeType type to instantiate (required)
* @param instanceName the name of tghe instance to retrun (required)
* @return NodeTemplateMap
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
NodeTemplateMap
getDefaultNodeType
(
String
id
,
String
nodeType
,
String
instanceName
)
throws
ApiException
{
ApiResponse
<
NodeTemplateMap
>
resp
=
getDefaultNodeTypeWithHttpInfo
(
id
,
nodeType
,
instanceName
);
return
resp
.
getData
();
}
/**
*
* returns an node templaye instance with the default required values.
*
* @param id ID of topolog template uplodaed (required)
* @param nodeType type to instantiate (required)
* @param instanceName the name of tghe instance to retrun (required)
* @return ApiResponse<NodeTemplateMap>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
ApiResponse
<
NodeTemplateMap
>
getDefaultNodeTypeWithHttpInfo
(
String
id
,
String
nodeType
,
String
instanceName
)
throws
ApiException
{
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultNodeTypeValidateBeforeCall
(
id
,
nodeType
,
instanceName
,
null
,
null
);
Type
localVarReturnType
=
new
TypeToken
<
NodeTemplateMap
>()
{
}.
getType
();
return
apiClient
.
execute
(
call
,
localVarReturnType
);
}
/**
* (asynchronously) returns an node templaye instance with the default
* required values.
*
* @param id ID of topolog template uplodaed (required)
* @param nodeType type to instantiate (required)
* @param instanceName the name of tghe instance to retrun (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing
* the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getDefaultNodeTypeAsync
(
String
id
,
String
nodeType
,
String
instanceName
,
final
ApiCallback
<
NodeTemplateMap
>
callback
)
throws
ApiException
{
ProgressResponseBody
.
ProgressListener
progressListener
=
null
;
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
=
null
;
if
(
callback
!=
null
)
{
progressListener
=
new
ProgressResponseBody
.
ProgressListener
()
{
@Override
public
void
update
(
long
bytesRead
,
long
contentLength
,
boolean
done
)
{
callback
.
onDownloadProgress
(
bytesRead
,
contentLength
,
done
);
}
};
progressRequestListener
=
new
ProgressRequestBody
.
ProgressRequestListener
()
{
@Override
public
void
onRequestProgress
(
long
bytesWritten
,
long
contentLength
,
boolean
done
)
{
callback
.
onUploadProgress
(
bytesWritten
,
contentLength
,
done
);
}
};
}
com
.
squareup
.
okhttp
.
Call
call
=
getDefaultNodeTypeValidateBeforeCall
(
id
,
nodeType
,
instanceName
,
progressListener
,
progressRequestListener
);
Type
localVarReturnType
=
new
TypeToken
<
NodeTemplateMap
>()
{
}.
getType
();
apiClient
.
executeAsync
(
call
,
localVarReturnType
,
callback
);
return
call
;
}
/**
* Build call for getDslDefinitions
*
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/JSON.java
View file @
28969573
...
...
@@ -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
;
...
...
@@ -71,12 +71,12 @@ public class JSON {
public
JSON
()
{
gson
=
createGson
()
.
registerTypeAdapter
(
Date
.
class
,
dateTypeAdapter
)
.
registerTypeAdapter
(
java
.
sql
.
Date
.
class
,
sqlDateTypeAdapter
)
.
registerTypeAdapter
(
OffsetDateTime
.
class
,
offsetDateTimeTypeAdapter
)
.
registerTypeAdapter
(
LocalDate
.
class
,
localDateTypeAdapter
)
.
registerTypeAdapter
(
byte
[].
class
,
byteArrayAdapter
)
.
create
();
.
registerTypeAdapter
(
Date
.
class
,
dateTypeAdapter
)
.
registerTypeAdapter
(
java
.
sql
.
Date
.
class
,
sqlDateTypeAdapter
)
.
registerTypeAdapter
(
OffsetDateTime
.
class
,
offsetDateTimeTypeAdapter
)
.
registerTypeAdapter
(
LocalDate
.
class
,
localDateTypeAdapter
)
.
registerTypeAdapter
(
byte
[].
class
,
byteArrayAdapter
)
.
create
();
}
/**
...
...
@@ -117,8 +117,8 @@ public class JSON {
/**
* Deserialize the given JSON string to Java object.
*
* @param <T> Type
* @param body The JSON string
* @param <T>
Type
* @param body
The JSON string
* @param returnType The type to deserialize into
* @return The deserialized Java object
*/
...
...
@@ -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
* I
f the dateFormat is null, I
SO8601Utils will be used.
*/
public
static
class
DateTypeAdapter
extends
TypeAdapter
<
Date
>
{
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/Pair.java
View file @
28969573
...
...
@@ -13,7 +13,7 @@
package
nl
.
uva
.
sne
.
drip
.
sure
.
tosca
.
client
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
5T13:58:54.535
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
8T19:11:27.492
Z"
)
public
class
Pair
{
private
String
name
=
""
;
private
String
value
=
""
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/StringUtil.java
View file @
28969573
...
...
@@ -13,7 +13,7 @@
package
nl
.
uva
.
sne
.
drip
.
sure
.
tosca
.
client
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
5T13:58:54.535
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-2
8T19:11:27.492
Z"
)
public
class
StringUtil
{
/**
* Check if the given array contains the given value (with case-insensitive comparison).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment