private void InitializeWriters() { var writeableProps = new List <EventPropertyDescriptor>(); var propertWritersMap = new Dictionary <String, Pair <EventPropertyDescriptor, MapEventBeanPropertyWriter> >(); foreach (EventPropertyDescriptor prop in PropertyDescriptors) { writeableProps.Add(prop); var propertyName = prop.PropertyName; var eventPropertyWriter = new MapEventBeanPropertyWriter(propertyName); propertWritersMap.Put(propertyName, new Pair <EventPropertyDescriptor, MapEventBeanPropertyWriter>(prop, eventPropertyWriter)); } PropertyWriters = propertWritersMap; WritablePropertyDescriptors = writeableProps.ToArray(); }
public override EventBeanWriter GetWriter(String[] properties) { if (WritablePropertyDescriptors == null) { InitializeWriters(); } var allSimpleProps = true; var writers = new MapEventBeanPropertyWriter[properties.Length]; for (var i = 0; i < properties.Length; i++) { var writerPair = PropertyWriters.Get(properties[i]); if (writerPair != null) { writers[i] = writerPair.Second; } else { writers[i] = (MapEventBeanPropertyWriter)GetWriter(properties[i]); if (writers[i] == null) { return(null); } allSimpleProps = false; } } if (allSimpleProps) { return(new MapEventBeanWriterSimpleProps(properties)); } else { return(new MapEventBeanWriterPerProp(writers)); } }