replaceAtIn*
Purpose
Replaces an element at a specified index in an existing instance’s embedded list, where the actual list used is indicated by the property used as the suffix to the method.
Examples
class Person {
List<Integer> scores
Set<String> friends
Map<String, String> pets
}
def person = Person.get(uuid)
person.replaceAtInScores(1, 9)
Person.replaceAtInScores([id: person.id], 2, 10, [flush:true])
Description
The replaceAtIn* method is a dynamic method that replaces an element at the specified position in an embedded list. The method exists as a static and instance method. The static method simply replaces the element in the datastore, the instance method replaces the element in the in-memory instance and the datastore.
Argument: * id - the id or primary key map of the instance. Only required if using the static method. * index - the index of the element to replace * element - element to be stored at the specified position * flush (optional) - When set to true flushes the persistence context, updating the datastore immediately