Nikhil Suthar
Nikhil Suthar

Reputation: 2431

How to concate Two ValueProvider and assign it to new ValueProvider?

I want to concatenate the value of two ValueProvider<String> and assign it to a new ValueProvider<String> How I can achieve it?

ValueProvider<String> A; //if A = Nikhil;
ValueProvider<String> B; //if B = Suthar;
ValueProvider<String> C = A + B; //Then C = Nikhil Suthar;

Upvotes: 0

Views: 371

Answers (4)

robertwb
robertwb

Reputation: 5104

You could also look into using flex templates instead, which avoid having to worry about ValueProviders at all.

Upvotes: 0

Jeff Klukas
Jeff Klukas

Reputation: 1357

This question comes up from time to time (see Dataflow. ValueProvider. How to create from several options? for example) but there is not currently support for combining ValueProviders in the Beam Java SDK. NestedValueProvider is available for transforming a runtime parameter, but it doesn't support multiple inputs.

Upvotes: 0

Roland J.
Roland J.

Reputation: 86

The ValueProvider provides a get() method (see Apache Beam). So you can do sth like this:

ValueProvider<String> a; 
ValueProvider<String> b; 
String c = a.get() + b.get();

Upvotes: 0

Related Questions