The following Job shows the code used for creating a "Class" using X++ code. This code may be used in scenarios like AIF service, Workflow generation etc processes where different objects like "Class" are created automatically using the similar code mentioned below.
static void BlogTestJob(Args _args)
{
ClassBuild classBuild;
str header;
str newClassName = "SampleClass";
;
header = 'public class '+ newClassName;
classBuild = new ClassBuild(newClassName);
classBuild.addMethod('classdeclaration', header + '\n{\n}\n');
classBuild.addMethod('main', 'public static void main(Args _args)' + '\n{\n}\n');
classBuild.classNode().AOTcompile(1);
info('Job completed....');
}
static void BlogTestJob(Args _args)
{
ClassBuild classBuild;
str header;
str newClassName = "SampleClass";
;
header = 'public class '+ newClassName;
classBuild = new ClassBuild(newClassName);
classBuild.addMethod('classdeclaration', header + '\n{\n}\n');
classBuild.addMethod('main', 'public static void main(Args _args)' + '\n{\n}\n');
classBuild.classNode().AOTcompile(1);
info('Job completed....');
}