private Instant verifyDateTime(Object value, String fieldName) { // We support the following classes for datetimes. if (value instanceof AbstractInstant) { return ((AbstractInstant) value).toInstant(); } else { throw new IllegalArgumentException( String.format( "For field name %s and DATETIME type got unexpected class %s ", fieldName, value.getClass())); } }