/// <summary>
 /// Constructor.
 /// </summary>
 public JavaConstructorInvocationGenerator(
     JavaFileBuilder builder,
     IList <JavaClass> javaClasses)
 {
     _builder     = builder;
     _javaClasses = javaClasses;
 }
예제 #2
0
        /// <summary>
        /// Generates an invocation of the question constructor that
        /// populates the resulting question with all of the existing
        /// question's data.
        /// </summary>
        public void GenerateConstructorInvocation(
            Question existingQuestion,
            JavaFileBuilder fileBuilder)
        {
            var javaModel = _questionModelFactory.GetQuestionModel();

            var constructorInvocationGenerator = _javaCodeGenerationFactory
                                                 .CreateConstructorInvocationGenerator(fileBuilder, javaModel);

            constructorInvocationGenerator.GenerateConstructorInvocation
            (
                existingQuestion,
                prefix: "return ",
                suffix: ";"
            );
        }
예제 #3
0
        /// <summary>
        /// Returns the contents of the file used to generate the question.
        /// </summary>
        private string GetGeneratorFile(string generatorContents, out int lineOffset)
        {
            var fileBuilder = new JavaFileBuilder();
            var javaModel   = _questionModelFactory.GetQuestionModel();

            foreach (var javaClass in javaModel)
            {
                var javaClassDefinitionGenerator = _javaCodeGenerationFactory
                                                   .CreateJavaClassDefinitionGenerator(fileBuilder, javaClass);

                javaClassDefinitionGenerator.GenerateClassDefinition();
                fileBuilder.AddBlankLine();
            }

            lineOffset = -fileBuilder.LinesAdded;
            fileBuilder.AddLines(generatorContents);

            return(fileBuilder.GetFileContents().Replace("%", "%%"));
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 public JavaClassDefinitionGenerator(JavaFileBuilder builder, JavaClass javaClass)
 {
     _builder   = builder;
     _javaClass = javaClass;
 }
 /// <summary>
 /// Creates a constructor invocation generator.
 /// </summary>
 public IJavaConstructorInvocationGenerator CreateConstructorInvocationGenerator(
     JavaFileBuilder fileBuilder,
     IList <JavaClass> javaClasses)
 {
     return(new JavaConstructorInvocationGenerator(fileBuilder, javaClasses));
 }
 /// <summary>
 /// Creates a java class definition generator.
 /// </summary>
 public IJavaClassDefinitionGenerator CreateJavaClassDefinitionGenerator(
     JavaFileBuilder fileBuilder,
     JavaClass javaClass)
 {
     return(new JavaClassDefinitionGenerator(fileBuilder, javaClass));
 }