readMappingConfig static method
Reads the attributes of the Mapping
annotations of a given Method,
and returns key value pairs, where the key is the target, and the value is an instance of MappingConfig
containing the source and other meta attributes
Implementation
static Map<String, MappingConfig> readMappingConfig(MethodElement method) {
final config = <String, MappingConfig>{};
final annotations = TypeChecker.fromRuntime(Mapping).annotationsOf(method);
for (final element in annotations) {
final reader = ConstantReader(element);
final sourceReader = reader.read('source');
config[reader.read('target').stringValue] = MappingConfig(
sourceReader.isNull ? null : sourceReader.objectValue,
reader.read('ignore').boolValue);
}
return config;
}