with

fun with(registration: Registration<*>): DynamicRegistry

This registry with registration in it.

A name stands for one class and a class goes under one name, so taking either twice is refused. The same class under the same name again is the registration it already is: it changes nothing, and in particular not the Json the class was first registered with, which there is no telling apart from an equivalent one built elsewhere. The write strategy can be told apart, and a second one is refused rather than left to decide by which client registered first.

Throws

INVALID_ARGUMENT where the name or the class is taken otherwise, or the class is registered under another write strategy.