fun Yaml( constructor: BaseConstructor, representer: Representer, dumperOptions: DumperOptions, resolver: Resolver ) { if (!constructor.isExplicitPropertyUtils()) { constructor.setPropertyUtils(representer.getPropertyUtils()) } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils()) } constructor = constructor representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle()) representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle()) representer.getPropertyUtils().setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties()) representer.setTimeZone(dumperOptions.getTimeZone()) representer = representer dumperOptions = dumperOptions resolver = resolver this.name = "Yaml:" + System.identityHashCode(this) }
Create Yaml instance . It is safe to create a few instances and use them in different Threads .