Skip to content

feature/java super callbacks #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import <#=mainNamespace#>.<#=c.GetPackagePrefix()#>.<#=c.TypeName()#>;
super(requestUrl, client, requestOptions, <#=c.TypeCollectionResponse()#>.class, <#=c.ITypeCollectionPage()#>.class);
}

public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback) {
public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback) {
<#
var navigationProperty = c.AsOdcmProperty().GetServiceCollectionNavigationPropertyForPropertyType(((CustomT4Host)Host).CurrentModel);
if (navigationProperty != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.TypeCo
super(requestUrl, client, requestOptions, <#=c.TypeCollectionResponse()#>.class, <#=c.ITypeCollectionPage()#>.class);
}

public void get(final ICallback<<#=c.ITypeCollectionPage()#>> callback) {
public void get(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback) {
final IExecutors executors = getBaseRequest().getClient().getExecutors();
executors.performOnBackground(new Runnable() {
@Override
Expand All @@ -50,7 +50,7 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.TypeCo
return buildFromResponse(response);
}

public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback) {
public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback) {
final String requestUrl = getBaseRequest().getRequestUrl().toString();
new <#=c.TypeRequestBuilder()#>(requestUrl, getBaseRequest().getClient(), /* Options */ null)
.buildRequest(getBaseRequest().getHeaders())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import <#=importNamespace#>.concurrency.IExecutors;
super(requestUrl, client, requestOptions, <#=c.TypeCollectionResponse()#>.class, <#=c.ITypeCollectionPage()#>.class);
}

public void get(final ICallback<<#=c.ITypeCollectionWithReferencesPage()#>> callback) {
public void get(final ICallback<? super <#=c.ITypeCollectionWithReferencesPage()#>> callback) {
final IExecutors executors = getBaseRequest().getClient().getExecutors();
executors.performOnBackground(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import <#=importNamespace#>.core.IBaseClient;
super(requestUrl, client, requestOptions, <#=c.ClassTypeName()#>.class);
}

public void delete(final ICallback<<#=c.TypeName()#>> callback) {
public void delete(final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.DELETE, callback, null);
}

Expand Down Expand Up @@ -77,7 +77,7 @@ import <#=importNamespace#>.core.IBaseClient;
* @param src<#=c.TypeName()#> the <#=c.TypeName()#> reference to PUT
* @param callback the callback to be called after success or failure
*/
public void put(<#=c.TypeName()#> src<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback) {
public void put(<#=c.TypeName()#> src<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.PUT, callback, src<#=c.TypeName()#>);
}

Expand Down
10 changes: 5 additions & 5 deletions Templates/Java/requests_extensions/BaseEntityRequest.java.tt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ import <#=importNamespace#>.http.HttpMethod;
*
* @param callback the callback when the deletion action has completed
*/
public void delete(final ICallback<{0}> callback) {{
public void delete(final ICallback<? super {0}> callback) {{
send(HttpMethod.DELETE, callback, null);
}}

Expand All @@ -162,7 +162,7 @@ import <#=importNamespace#>.http.HttpMethod;
*
* @param callback the callback to be called after success or failure
*/
public void get(final ICallback<{0}> callback) {{
public void get(final ICallback<? super {0}> callback) {{
send(HttpMethod.GET, callback, null);
}}

Expand All @@ -189,7 +189,7 @@ import <#=importNamespace#>.http.HttpMethod;
* @param source{0} the source object with updates
* @param callback the callback to be called after success or failure
*/
public void patch(final {0} source{0}, final ICallback<{0}> callback) {{
public void patch(final {0} source{0}, final ICallback<? super {0}> callback) {{
send(HttpMethod.PATCH, callback, source{0});
}}

Expand Down Expand Up @@ -217,7 +217,7 @@ import <#=importNamespace#>.http.HttpMethod;
* @param new{0} the new object to create
* @param callback the callback to be called after success or failure
*/
public void post(final {0} new{0}, final ICallback<{0}> callback) {{
public void post(final {0} new{0}, final ICallback<? super {0}> callback) {{
send(HttpMethod.POST, callback, new{0});
}}

Expand Down Expand Up @@ -245,7 +245,7 @@ import <#=importNamespace#>.http.HttpMethod;
* @param new{0} the object to create/update
* @param callback the callback to be called after success or failure
*/
public void put(final {0} new{0}, final ICallback<{0}> callback) {{
public void put(final {0} new{0}, final ICallback<? super {0}> callback) {{
send(HttpMethod.PUT, callback, new{0});
}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;
super(requestUrl, client, requestOptions, <#=c.ClassTypeName()#>.class);
}

public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final IJsonBackedObject payload, final ICallback<<#=c.TypeName()#>> callback) {
public void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final IJsonBackedObject payload, final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.POST, callback, payload);
}

Expand All @@ -38,23 +38,23 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;
return null;
}

public void get(final ICallback<<#=c.TypeName()#>> callback) {
public void get(final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.GET, callback, null);
}

public <#=c.TypeName()#> get() throws ClientException {
return send(HttpMethod.GET, null);
}

public void delete(final ICallback<<#=c.TypeName()#>> callback) {
public void delete(final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.DELETE, callback, null);
}

public void delete() throws ClientException {
send(HttpMethod.DELETE, null);
}

public void patch(final <#=c.TypeName()#> source<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback) {
public void patch(final <#=c.TypeName()#> source<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback) {
send(HttpMethod.PATCH, callback, source<#=c.TypeName()#>);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import <#=importNamespace#>.http.HttpMethod;
body = new <#=c.TypeBody()#>();
}

public void post(final ICallback<<#=returnType#>> callback) {
public void post(final ICallback<? super <#=returnType#>> callback) {
send(HttpMethod.POST, callback, body);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import <#=importNamespace#>.concurrency.IExecutors;

<# if (c.AsOdcmMethod().IsAction()) { #>

public void post(final ICallback<<#=c.ITypeCollectionPage()#>> callback) {
public void post(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback) {
final IExecutors executors = getBaseRequest().getClient().getExecutors();
executors.performOnBackground(new Runnable() {
@Override
Expand All @@ -72,7 +72,7 @@ import <#=importNamespace#>.concurrency.IExecutors;

<# } else { #>

public void get(final ICallback<<#=c.ITypeCollectionPage()#>> callback) {
public void get(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback) {
final IExecutors executors = getBaseRequest().getClient().getExecutors();
executors.performOnBackground(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (c.AsOdcmMethod().IsAction()) {
*
* @param callback the callback to be called after success or failure
*/
public void post(final ICallback<<#=c.ReturnType()#>> callback) {
public void post(final ICallback<? super <#=c.ReturnType()#>> callback) {
send(HttpMethod.POST, callback, null);
}

Expand Down Expand Up @@ -154,7 +154,7 @@ if (c.AsOdcmMethod().IsAction()) {
* @param src<#=c.ReturnType()#> the <#=c.ReturnType()#> with which to PATCH
* @param callback the callback to be called after success or failure
*/
public void patch(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<<#=c.ReturnType()#>> callback) {
public void patch(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<? super <#=c.ReturnType()#>> callback) {
send(HttpMethod.PATCH, callback, src<#=c.ReturnType()#>);
}

Expand All @@ -175,7 +175,7 @@ if (c.AsOdcmMethod().IsAction()) {
* @param src<#=c.ReturnType()#> the <#=c.ReturnType()#> to PUT
* @param callback the callback to be called after success or failure
*/
public void put(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<<#=c.ReturnType()#>> callback) {
public void put(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<? super <#=c.ReturnType()#>> callback) {
send(HttpMethod.PUT, callback, src<#=c.ReturnType()#>);
}

Expand All @@ -197,7 +197,7 @@ if (c.AsOdcmMethod().IsAction()) {
*
* @param callback the callback to be called after success or failure
*/
public void get(final ICallback<<#=c.ReturnType()#>> callback) {
public void get(final ICallback<? super <#=c.ReturnType()#>> callback) {
send(HttpMethod.GET, callback, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import java.io.InputStream;
* @param fileContents the contents of the stream to upload
* @param callback the callback to be called after success or failure
*/
public void put(final byte[] fileContents, final ICallback<<#=c.ClassTypeName()#>> callback) {
public void put(final byte[] fileContents, final ICallback<? super <#=c.ClassTypeName()#>> callback) {
send(fileContents, callback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import <#=mainNamespace#>.<#=c.GetPackagePrefix()#>.<#=c.TypeName()#>;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionReferenceRequest())#>

void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback);
void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> post(final <#=c.TypeName()#> new<#=c.TypeName()#>) throws ClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import <#=importNamespace#>.http.IHttpRequest;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionRequest(), "IHttpRequest")#>

void get(final ICallback<<#=c.ITypeCollectionPage()#>> callback);
void get(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback);

<#=c.ITypeCollectionPage()#> get() throws ClientException;

void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback);
void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> post(final <#=c.TypeName()#> new<#=c.TypeName()#>) throws ClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import <#=importNamespace#>.http.IHttpRequest;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionWithReferencesRequest(), "IHttpRequest")#>

void get(final ICallback<<#=c.ITypeCollectionWithReferencesPage()#>> callback);
void get(final ICallback<? super <#=c.ITypeCollectionWithReferencesPage()#>> callback);

<#=c.ITypeCollectionWithReferencesPage()#> get() throws ClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeReferenceRequest(), "IHttpRequest")#>

void delete(final ICallback<<#=c.TypeName()#>> callback);
void delete(final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> delete() throws ClientException;

Expand Down Expand Up @@ -45,7 +45,7 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;
* @param src<#=c.TypeName()#> the <#=c.TypeName()#> to PUT
* @param callback the callback to be called after success or failure
*/
void put(<#=c.TypeName()#> src<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback);
void put(<#=c.TypeName()#> src<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback);

/**
* Puts the <#=c.TypeName()#>
Expand Down
10 changes: 5 additions & 5 deletions Templates/Java/requests_extensions/IBaseEntityRequest.java.tt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import <#=importNamespace#>.http.IHttpRequest;
*
* @param callback the callback when the deletion action has completed
*/
void delete(final ICallback<{0}> callback);
void delete(final ICallback<? super {0}> callback);

/**
* Delete this item from the service
Expand All @@ -108,7 +108,7 @@ import <#=importNamespace#>.http.IHttpRequest;
*
* @param callback the callback to be called after success or failure
*/
void get(final ICallback<{0}> callback);
void get(final ICallback<? super {0}> callback);

/**
* Gets the {0} from the service
Expand All @@ -131,7 +131,7 @@ import <#=importNamespace#>.http.IHttpRequest;
* @param source{0} the source object with updates
* @param callback the callback to be called after success or failure
*/
void patch(final {0} source{0}, final ICallback<{0}> callback);
void patch(final {0} source{0}, final ICallback<? super {0}> callback);

/**
* Patches this {0} with a source
Expand All @@ -155,7 +155,7 @@ import <#=importNamespace#>.http.IHttpRequest;
* @param new{0} the new object to create
* @param callback the callback to be called after success or failure
*/
void post(final {0} new{0}, final ICallback<{0}> callback);
void post(final {0} new{0}, final ICallback<? super {0}> callback);

/**
* Posts a {0} with a new object
Expand All @@ -179,7 +179,7 @@ import <#=importNamespace#>.http.IHttpRequest;
* @param new{0} the object to create/update
* @param callback the callback to be called after success or failure
*/
void put(final {0} new{0}, final ICallback<{0}> callback);
void put(final {0} new{0}, final ICallback<? super {0}> callback);

/**
* Posts a {0} with a new object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ import <#=importNamespace#>.serializer.IJsonBackedObject;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeWithReferencesRequest(), "IHttpRequest")#>

void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final IJsonBackedObject payload, final ICallback<<#=c.TypeName()#>> callback);
void post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final IJsonBackedObject payload, final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> post(final <#=c.TypeName()#> new<#=c.TypeName()#>, final IJsonBackedObject payload) throws ClientException;

void get(final ICallback<<#=c.TypeName()#>> callback);
void get(final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> get() throws ClientException;

void delete(final ICallback<<#=c.TypeName()#>> callback);
void delete(final ICallback<? super <#=c.TypeName()#>> callback);

void delete() throws ClientException;

void patch(final <#=c.TypeName()#> source<#=c.TypeName()#>, final ICallback<<#=c.TypeName()#>> callback);
void patch(final <#=c.TypeName()#> source<#=c.TypeName()#>, final ICallback<? super <#=c.TypeName()#>> callback);

<#=c.TypeName()#> patch(final <#=c.TypeName()#> source<#=c.TypeName()#>) throws ClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import <#=importNamespace#>.http.IHttpRequest;

<#=TypeHelperJava.CreateInterfaceDef(iBaseTypeRequest, "IHttpRequest")#>

void post(final ICallback<<#=c.ReturnType()#>> callback);
void post(final ICallback<? super <#=c.ReturnType()#>> callback);

<#=c.ReturnType()#> post() throws ClientException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import com.google.gson.annotations.Expose;
<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionRequest(), "IHttpRequest")#>

<# if (c.AsOdcmMethod().IsAction()) { #>
void post(final ICallback<<#=c.ITypeCollectionPage()#>> callback);
void post(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback);

<#=c.ITypeCollectionPage()#> post() throws ClientException;
<# } else { #>
void get(final ICallback<<#=c.ITypeCollectionPage()#>> callback);
void get(final ICallback<? super <#=c.ITypeCollectionPage()#>> callback);

<#=c.ITypeCollectionPage()#> get() throws ClientException;
<# } #>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (c.AsOdcmMethod().IsAction()) {
*
* @param callback the callback to be called after success or failure
*/
void post(final ICallback<<#=c.ReturnType()#>> callback);
void post(final ICallback<? super <#=c.ReturnType()#>> callback);

/**
* Creates the <#=c.TypeName()#>
Expand Down Expand Up @@ -103,7 +103,7 @@ if (c.AsOdcmMethod().IsAction()) {
* @param src<#=c.ReturnType()#> the <#=c.ReturnType()#> with which to PATCH
* @param callback the callback to be called after success or failure
*/
void patch(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<<#=c.ReturnType()#>> callback);
void patch(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<? super <#=c.ReturnType()#>> callback);

/**
* Patches the <#=c.TypeName()#>
Expand All @@ -120,7 +120,7 @@ if (c.AsOdcmMethod().IsAction()) {
* @param src<#=c.ReturnType()#> the <#=c.ReturnType()#> to PUT
* @param callback the callback to be called after success or failure
*/
void put(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<<#=c.ReturnType()#>> callback);
void put(<#=c.ReturnType()#> src<#=c.ReturnType()#>, final ICallback<? super <#=c.ReturnType()#>> callback);

/**
* Puts the <#=c.TypeName()#>
Expand All @@ -138,7 +138,7 @@ if (c.AsOdcmMethod().IsAction()) {
*
* @param callback the callback to be called after success or failure
*/
void get(final ICallback<<#=c.ReturnType()#>> callback);
void get(final ICallback<? super <#=c.ReturnType()#>> callback);

/**
* Gets the <#=c.ReturnType()#>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import java.io.InputStream;
* @param fileContents the contents of the stream to upload
* @param callback the callback to be called after success or failure
*/
void put(final byte[] fileContents, final ICallback<<#=c.ClassTypeName()#>> callback);
void put(final byte[] fileContents, final ICallback<? super <#=c.ClassTypeName()#>> callback);

/**
* Uploads to the stream
Expand Down
Loading