public ClassMemberDescriptor(ClassDescriptor descriptor, MemberInfo member) { var property = member as PropertyInfo; this.AccessModifier = AccessModifier.Public; if (property != null) { this.MemberType = property.PropertyType; } var field = member as FieldInfo; if (field != null) { this.MemberType = field.FieldType; } this.AccessModifier = AccessModifier.GetAccessModifier(member); if (this.MemberType == null) throw new NPlantException("Member's could not be interpretted as either a property or a field"); _descriptor = descriptor; this.Name = member.Name; this.Key = this.Name; _metaModel = ClassDiagramVisitorContext.Current.GetTypeMetaModel(this.MemberType); this.IsInherited = member.DeclaringType != descriptor.ReflectedType; }
public void AddRelated(ClassDescriptor parent, ClassDescriptor child, ClassDiagramRelationshipTypes relationshipType, int level, string name = null) { if (! AlreadyRegistered(child)) _unvisitedRelatedClasses.Enqueue(child); var relationship = new ClassDiagramRelationship(name, parent, child, relationshipType); if (!_relationships.Contains(relationship)) _relationships.Add(relationship); }
private bool IsBaseClassVisible(ClassDescriptor @class, ClassDiagramVisitorContext context) { if (_diagram.RootClasses.InnerList.Any(x => x.ReflectedType == @class.ReflectedType.BaseType)) return true; if (context.VisitedRelatedClasses.Any(x => x.ReflectedType == @class.ReflectedType.BaseType)) return true; return false; }
private bool AlreadyRegistered(ClassDescriptor child) { if(_visitedRelatedClasses.Contains(child)) return true; if (_unvisitedRelatedClasses.Contains(child)) return true; if (this.Diagram.RootClasses.InnerList.Contains(child)) return true; return false; }
private void AssignToPackage(ClassDescriptor rootClass, Dictionary<string, List<string>> packageMap, string classDefinition, List<string> unpackaged) { foreach (var package in _diagram.Packages) { if (package.IsMatch(rootClass)) { AppendClassToPackageMap(packageMap, package.Name, classDefinition); return; } } unpackaged.Add(classDefinition); }
public ClassWriter(ClassDiagram diagram, ClassDescriptor @class) { _diagram = diagram; this._class = @class; }
protected override void OnRootClassVisited(ClassDescriptor rootClass) { _classes.Add(rootClass); }
private string WriteClassDefinition(ClassDescriptor @class) { var writer = @class.GetWriter(_diagram); return writer.Write(_context); }
protected virtual void OnRootClassVisited(ClassDescriptor rootClass) { }
public ForMemberDescriptor(ClassDescriptor descriptor, MemberInfo member) { _descriptor = descriptor; _member = member; }
public bool IsMatch(ClassDescriptor classDescriptor) { return _matcher.Any(matcher => matcher(classDescriptor)); }