the ContentFailure holds a list : List<ModddelInvalidMember> invalidMembers
, where ModddelInvalidMember
is a wrapper class that holds an invalid modddel and its description. This description is used in the toString
method of the ContentFailure. It varies depending on the entity kind.
The description is by default "item $index"
, except for the MappedKeys/MappedValues kinds where it's "entry $index"
.
You can customize the description for any IterableEntity by overriding the $description
method.
For example : Let's say we have a BookList
ListEntity that holds a list of books.
You can also optionally override the $descriptionDetails
method. This method has two parameters : the modddel
that is held inside the collection and its index. It returns a string that will be appended to the description, in parenthesis.
In our example :
The collection of an Iterable2Entity can be converted to two iterables of modddels. Therefore, there are two descriptions, one for each iterable.
By default :
The description of the modddels of the first iterable is "first $index"
, except for the Map kinds (MapEntity...) where it's "key $index"
.
The description of the modddels of the second iterable is "second $index"
, except for the Map kinds (MapEntity...) where it's "value $index"
.
You can customize these descriptions by overriding respectively the $description1
and $description2
methods.
You can also optionally override the $descriptionDetails1
and $descriptionDetails2
methods.