in google-cloud-spanner-hibernate-dialect/src/main/java/com/google/cloud/spanner/hibernate/hints/ReplaceQueryPartsHint.java [296:308]
private static String getAsString(JsonObject jsonObject, String fieldName, boolean optional) {
JsonElement element = jsonObject.get(fieldName);
if (element == null) {
if (optional) {
return null;
}
throw new HibernateException("Missing " + fieldName + " field in replacement object");
}
if (!element.isJsonPrimitive()) {
throw new HibernateException(fieldName + " must be a string");
}
return element.getAsString();
}