static Resource from()

in invoker/core/src/main/java/com/google/cloud/functions/invoker/CloudFunctionsContext.java [105:112]


    static Resource from(String s) {
      if (s.startsWith("{") && (s.endsWith("}") || s.endsWith("}\n"))) {
        TypeAdapter<Resource> typeAdapter = typeAdapter(new Gson());
        Gson gson = new GsonBuilder().registerTypeAdapter(Resource.class, typeAdapter).create();
        return gson.fromJson(s, Resource.class);
      }
      return builder().setName(s).build();
    }