github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/hello/java/Func.java (about) 1 import com.google.gson.Gson; 2 import com.google.gson.stream.JsonReader; 3 4 import java.io.InputStreamReader; 5 6 public class Func { 7 8 /** 9 * @param args the command line arguments 10 */ 11 public static void main(String[] args) { 12 JsonReader br = new JsonReader(new InputStreamReader(System.in)); 13 Gson gson = new Gson(); 14 Payload payload = gson.fromJson(br, Payload.class); 15 if (payload == null) { 16 payload = new Payload("world"); 17 } 18 19 System.out.printf("Hello %s!\n", payload.getName()); 20 21 } 22 } 23 24