public ClassMemberCollection Add(ClassMember classMember, bool addGetterSetter = true) { ClassMembers.Add(classMember); classMember.Owner = Owner; if (!classMember.NonAccessModifiers.Contains(Abstract) && !classMember.NonAccessModifiers.Contains(Final) && !classMember.NonAccessModifiers.Contains(Static) && addGetterSetter) { GetterFunctions.Add(new GetterFunction(classMember)); SetterFunctions.Add(new SetterFunction(classMember)); } return(this); }
public ModelClass(EntityClass eClass, string module) { EntityClass = eClass; Name = eClass.EntityConstraints.TableName.ToPascalCase() + "Model"; Package = $@"havelsan.kovan.{module}.common.dto"; BaseClass = PredefinedClasses.HvlModel; foreach (var classMember in EntityClass.ClassMembers.ClassMembers) { var cm = new ClassMember(classMember.Name, classMember.Type, classMember.Value, classMember.AccessModifier, classMember.NonAccessModifiers.ToArray()); foreach (var annotation in classMember.Annotations.Where(x => !x.Package.IsParent("javax.persistence"))) { var an = new Annotation(annotation.Name, annotation.Package, annotation.Parameters.Values.ToArray()); cm.Annotations.Add(an); } ClassMembers.Add(cm); } }
public EntityConstraintsClass(Table table, string module) { Table = table; Name = Table.SafeName.ToPascalCase() + "Constraints"; Package = $@"havelsan.kovan.{module}.common.constraints"; NonAccessModifiers = new List <NonAccessModifier> { NonAccessModifier.Abstract }; ClassMembers.Add(CreatePublicStaticFinalString("TABLE_NAME", Table.Name)); IfPresent(Table.Sequence, ts => CreatePublicStaticFinalString("SEQ_NAME", ts.Name)); ClassMembers .AddRange(Table.Columns.Select(x => CreatePublicStaticFinalString($@"COLUMN_{x.Name}", x.Name))) .AddRange(Table.UniqueContraints.Select(x => CreatePublicStaticFinalString($@"{(x.Name.StartsWith("UX_") ? x.Name : "UX_" + x.Name)}", x.Name))) .AddRange(Table.Columns.Where(x => x.Size != null).SelectMany(x => { var list = new List <ClassMember>(); x.Size.Min.IfPresent(min => list.Add(CreatePublicStaticFinalInt($@"{x.Name}_SIZE_MIN", min))); x.Size.Max.IfPresent(max => list.Add(CreatePublicStaticFinalInt($@"{x.Name}_SIZE_MAX", max))); return(list); })); }