/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Component or Subcomponent. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.AbstractComponent primitive, int profileType) { GeneratedPrimitive genClass = new GeneratedPrimitive(); ProfileName profileName = new ProfileName(primitive.Name, profileType); // Set up class genClass.ClassPackage = packageName; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); genClass.Properties = "extends AbstractConformanceDataType"; genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { // Add constant value constraints if there are any genClass.addConstantValue(primitive.ConstantValue); } else { // if no constant value, then we add a setter method GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) { System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); } depManager.generateFile(genClass, packageName, genClass.Name); }
/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Component or Subcomponent. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.AbstractComponent primitive, int profileType) { GeneratedPrimitive genClass = new GeneratedPrimitive(); ProfileName profileName = new ProfileName(primitive.Name, profileType); // Set up class genClass.ClassPackage = packageName; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); genClass.Properties = "extends AbstractConformanceDataType"; genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { // Add constant value constraints if there are any genClass.addConstantValue(primitive.ConstantValue); } else { // if no constant value, then we add a setter method GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); depManager.generateFile(genClass, packageName, genClass.Name); }
/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Field. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.Field primitive, System.String parentUnderlyingType, ProfileName profileName) { GeneratedPrimitive genClass = new GeneratedPrimitive(); // Check for possible snags in the Runtime Profile Component if (primitive.Name == null || primitive.Name.Length < 1) throw new ConformanceError("Error building ConformanceSegment: Runtime AbstractComponent does not contain a name."); GeneratedMethod theConstructor = new GeneratedMethod(); genClass.Constructor = theConstructor; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); UnderlyingAccessor underlyingAccessor = new UnderlyingAccessor(parentUnderlyingType, profileName.AccessorName); theConstructor.addParam(parentUnderlyingType + " parentSeg", "The parent underlying data type"); theConstructor.addParam("int rep", "The desired repetition"); theConstructor.Name = profileName.ClassName; theConstructor.Visibility = "public "; theConstructor.addToThrows("Genetibase.NuGenHL7.HL7Exception"); theConstructor.addToBody("super( (Primitive)parentSeg." + underlyingAccessor + " );"); theConstructor.addToBody("if ( parentSeg." + underlyingAccessor + " == null )"); theConstructor.addToBody(" throw new Genetibase.NuGenHL7.HL7Exception( \"Error accussing underlying object. This is a bug.\", 0 );"); // Set up class genClass.ClassPackage = packageName; //genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); //genClass.addClassImport( "Genetibase.NuGenHL7.conf.classes.exceptions.*" ); genClass.Properties = "extends AbstractConformanceDataType implements Repeatable"; // Add min and max reps stuff genClass.setMinMaxReps(primitive.Min, primitive.Max); genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); // Add constant value constraints if there are any, if not, add a setter method if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { genClass.addConstantValue(primitive.ConstantValue); } else { GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); depManager.generateFile(genClass, packageName, genClass.Name); }
/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Field. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.Field primitive, System.String parentUnderlyingType, ProfileName profileName) { GeneratedPrimitive genClass = new GeneratedPrimitive(); // Check for possible snags in the Runtime Profile Component if (primitive.Name == null || primitive.Name.Length < 1) { throw new ConformanceError("Error building ConformanceSegment: Runtime AbstractComponent does not contain a name."); } GeneratedMethod theConstructor = new GeneratedMethod(); genClass.Constructor = theConstructor; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); UnderlyingAccessor underlyingAccessor = new UnderlyingAccessor(parentUnderlyingType, profileName.AccessorName); theConstructor.addParam(parentUnderlyingType + " parentSeg", "The parent underlying data type"); theConstructor.addParam("int rep", "The desired repetition"); theConstructor.Name = profileName.ClassName; theConstructor.Visibility = "public "; theConstructor.addToThrows("Genetibase.NuGenHL7.HL7Exception"); theConstructor.addToBody("super( (Primitive)parentSeg." + underlyingAccessor + " );"); theConstructor.addToBody("if ( parentSeg." + underlyingAccessor + " == null )"); theConstructor.addToBody(" throw new Genetibase.NuGenHL7.HL7Exception( \"Error accussing underlying object. This is a bug.\", 0 );"); // Set up class genClass.ClassPackage = packageName; //genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); //genClass.addClassImport( "Genetibase.NuGenHL7.conf.classes.exceptions.*" ); genClass.Properties = "extends AbstractConformanceDataType implements Repeatable"; // Add min and max reps stuff genClass.setMinMaxReps(primitive.Min, primitive.Max); genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); // Add constant value constraints if there are any, if not, add a setter method if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { genClass.addConstantValue(primitive.ConstantValue); } else { GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) { System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); } depManager.generateFile(genClass, packageName, genClass.Name); }