Skip to content

Use java boxed types when setting well known types #2055

@jhspaybar

Description

@jhspaybar

I would like the functionality that using things like Int32Value, Int64Value, StringValue, BoolValue, etc would allow for using setters of the form setFoo(Integer), setFoo(Long), setFoo(String), setFoo(Boolean) where a passed null will essentially no-op, but a value would call the XYZValue.newBuilder.setValue(arg), but that on the getter side of things the interactions still have hasFoo() and getFoo().getValue() to access the data. Given that the return type can't be type parameterized easily in Java, this seems like a good place to start, possibly with discussion as to whether there should be getters of the form getNullableFoo() or getOptionalFoo that gets generated.

If this is something that would be helpful to others(I think it would) I'd be happy to contribute a pull request that at least makes these changes to the setter side of things with further discussion for proper use on the getter side.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions