Skip to content

Package setters on SDK Request classes #587

Description

@gboersma

It should be possible to create an instance of a request class, e.g. the InvokeMethodRequest class, set the parameters on it, and then call <T> Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef<T> type); on DaprClient. However, the setters defined on InvokeMethodRequest are package scope, so they cannot be called. The setters should have public scope, or there should be a constructor that allows them to be set.

Same comment applies to PublishEventRequest, InvokeBindingRequest, GetStateRequest, BulkStateRequest, DeleteStateRequest, GetSecretRequest, GetBulkSecretRequest. ExecuteStateTransactionRequest has a constructor that sets the parameters, but could perhaps also benefit from setters.

I do see the Builder pattern is available (e.g. InvokeMethodRequestBuilder), so that can always be used instead. However, this is overkill for just setting parameters for the request. Also, the builder pattern is not quite right- there should be a static method on a builder class to instantiate a new builder, rather than having to instantiate a builder via new- typically, constructors on a builder have package / private access. And rather than setting the name of the service and method in a constructor on the builder, these should be additonal methods on the builder class to make it more explicit what is being set.

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions