}
}
for (Entry<Class, ScalarSerializer> entry : config.scalarSerializers.entrySet()) {
if (entry.getKey().isAssignableFrom(type)) {
ScalarSerializer serializer = entry.getValue();
Event event = parser.getNextEvent();
if (event.type != SCALAR)
throw new YamlReaderException("Expected scalar for type '" + type + "' to be deserialized by scalar serializer '"
+ serializer.getClass().getName() + "' but found: " + event.type);
Object value = serializer.read(((ScalarEvent)event).value);
if (anchor != null) anchors.put(anchor, value);
return value;
}
}