protected override IGroup CreateNewGroup(GroupDescription groupDescription) { if (groupDescription.Key != null && groupDescription.Key != "Radio") { throw new ArgumentException("We only know about RadioGroups at present, not: " + groupDescription.Key); } return new RadioGroup(); }
protected abstract IGroup CreateNewGroup(GroupDescription groupDescription);
private void FillGroup(object element, GroupDescription groupDescription) { if (groupDescription == null) return; var rootElement = element as IRootElement; if (rootElement == null) { throw new ArgumentException("You cannot set a group on an Element of type " + element.GetType().Name); } var group = CreateNewGroup(groupDescription); FillProperties(group, groupDescription.Properties); rootElement.Group = group; }