Combining a meta data file and java source code to dynamically create java classes and javabeans
First Claim
1. Computer readable code readable by a computing system in a computing environment, for combining a meta data file and Java source code file to dynamically create Java classes and JavaBeans, comprising:
- a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
a Java source code input file, wherein said input file comprises a plurality of lines, and wherein each of said lines may be characterized as a normal Java source code statement or as a line within a scope of a macro reference;
a Java source code output file;
a subprocess for copying each of said normal Java source code statements to said output file; and
a subprocess for processing each of said lines within said scope of said macro reference, further comprising;
a subprocess for locating one or more matching macro specifications in said meta data file, wherein said name of said matching macro specification is identical to a reference name used in said macro reference;
a subprocess for expanding said lines within said scope of said macro reference using said one or more located specifications; and
a subprocess for writing said expanded lines to said output file.
2 Assignments
0 Petitions
Accused Products
Abstract
A technique for combining a meta data file and Java source code to dynamically create Java classes and JavaBeans. This technique enables creating objects and JavaBeans in a new, more flexible manner. An approach similar to, but different from, existing macro definition and expansion is used. According to the present invention, placeholders for parameter values are specified in the main source code file, and the values to be substituted for these placeholders are contained in an auxilliary file, referred to as a “meta file” or “meta data file”. By isolating the parameter values outside the source code file in this manner, the values are much easier to change. The change does not affect the source code file itself. Instead, the change is reflected in a new file created during the expansion process. This approach enables an end-user to easily specify objects to be created, and/or the instance data to be used for creating a particular object (i.e. the values to be used for the parameters), without having to know Java code syntax and without having to obtain write permissions to the Java source code. The approach of the present invention also allows a particular macro to be used in different ways throughout a source code file. A particular macro name can be referenced multiple times in the source code file, with the ability to specify substitution of a selectable subset of the parameter values where that subset may change from one reference to another. In addition, a macro name can be specified multiple times in the meta file of the present invention, with parameter values that may change from one specification to another. Optionally, a conditional expansion feature may be used. The technique of the present invention may be used advantageously with object-oriented languages other than the Java programming language.
-
Citations
32 Claims
-
1. Computer readable code readable by a computing system in a computing environment, for combining a meta data file and Java source code file to dynamically create Java classes and JavaBeans, comprising:
-
a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
a Java source code input file, wherein said input file comprises a plurality of lines, and wherein each of said lines may be characterized as a normal Java source code statement or as a line within a scope of a macro reference;
a Java source code output file;
a subprocess for copying each of said normal Java source code statements to said output file; and
a subprocess for processing each of said lines within said scope of said macro reference, further comprising;
a subprocess for locating one or more matching macro specifications in said meta data file, wherein said name of said matching macro specification is identical to a reference name used in said macro reference;
a subprocess for expanding said lines within said scope of said macro reference using said one or more located specifications; and
a subprocess for writing said expanded lines to said output file. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
a subprocess for detecting an opening macro reference, said opening macro reference specifying said reference name, and wherein said detected opening reference begins said scope of said macro reference;
a subprocess for detecting a closing macro reference, wherein said detected closing reference ends said scope of said macro reference; and
wherein said detected opening and closing macro references are not themselves expanded by said subprocess for expanding.
-
-
3. Computer readable code according to claim 2, wherein said subprocess for expanding further comprises:
-
a subprocess for parsing each of said lines within said scope of said macro reference;
a subprocess for copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
a subprocess for expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
4. Computer readable code according to claim 3, wherein said subprocess for expanding said parsed line further comprises:
-
a subprocess for retrieving a corresponding one of said parameter values from said located macro specification using a sequence number from said macro parameter reference; and
a subprocess for substituting said retrieved parameter value for said macro parameter reference, wherein said subprocess for retrieving and said subprocess for substituting are repeated for each of said one or more macro parameter references in said parsed line.
-
-
5. Computer readable code according to claim 2, wherein said subprocess for expanding further comprises:
-
a subprocess for parsing each of said lines within said scope of said macro reference;
a subprocess for detecting an opening conditional macro processing statement in said parsed line;
a subprocess for evaluating said detected opening conditional macro processing statement;
a subprocess for bypassing one or more lines within said scope of said macro reference until detecting an ending conditional macro processing statement when said subprocess for evaluating has a negative result; and
a subprocess for expanding one or more of said lines of said input file when said subprocess for evaluating has a positive result, until detecting said ending conditional macro processing statement.
-
-
6. Computer readable code according to claim 5, wherein said subprocess for evaluating has said positive result when a condition on said opening conditional macro processing statement evaluates to a Boolean value “
- True”
.
- True”
-
7. Computer readable code according to claim 6, wherein said subprocess for evaluating further comprises:
-
a subprocess for locating a string value in said condition;
a subprocess for retrieving a corresponding condition value from said located macro specification using a conditional parameter sequence number from said condition; and
a subprocess for comparing said retrieved corresponding value to said string value.
-
-
8. Computer readable code according to claim 7, wherein said subprocess for expanding further comprises:
-
a subprocess for parsing each of said lines within said scope of said macro reference;
a subprocess for copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
a subprocess for expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
9. Computer readable code according to claim 8, wherein said subprocess for expanding said parsed line further comprises:
-
a subprocess for retrieving a corresponding one of said parameter values from said matching macro specification using a sequence number from said macro parameter reference; and
a subprocess for substituting said retrieved parameter value for said macro parameter reference, wherein said subprocess for retrieving and said subprocess for substituting are repeated for each of said one or more macro parameter references in said parsed line.
-
-
10. Computer readable code readable by a computing system in a computing environment, for combining a meta data file and Java source code file to dynamically create Java classes and JavaBeans, comprising:
-
a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
a Java source code input file, wherein said input file comprises a plurality of lines;
a Java source code output file;
a subprocess for reading each of said lines of said input file;
a subprocess, responsive to said subprocess for reading, for determining whether said read line is within a scope of a macro reference;
a subprocess for copying said read line to said output file when said subprocess for determining has a negative result; and
a subprocess for expanding said read line using said meta data file when said subprocess for determining has a positive result. - View Dependent Claims (11, 12)
a subprocess for parsing each of said lines within said scope of said macro reference;
a subprocess for copying each of said parsed lines which does not contain a macro parameter reference to said output file;
a subprocess for expanding said parsed line when said parsed line contains one or more of said macro parameter references; and
a subprocess for writing said expanded parsed line to said output file.
-
-
12. Computer readable code according to claim 11, wherein:
-
said subprocess for determining has said positive result when an opening macro reference has been encountered but a corresponding closing macro reference has not; and
said subprocess for expanding said parsed line further comprises;
a subprocess for locating one or more matching macro specifications in said meta data file using a reference name from said opening macro reference to match said macro name in said meta data file; and
a subprocess for using each of said matching macro specifications to create said expanded parsed line, further comprising;
a subprocess for retrieving a corresponding one of said parameter values from said matching macro specification using a sequence number from said macro parameter reference; and
a subprocess for substituting said retrieved parameter value for said macro parameter reference, wherein said subprocess for retrieving and said subprocess for substituting are repeated for each of said one or more macro parameter references in said parsed line.
-
-
13. A system for combining a meta data file and Java source code file to dynamically create Java classes and JavaBeans in a computing environment, comprising:
-
a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
a Java source code input file, wherein said input file comprises a plurality of lines, and wherein each of said lines may be characterized as a normal Java source code statement or as a line within a scope of a macro reference;
a Java source code output file;
means for copying each of said normal Java source code statements to said output file; and
means for processing each of said lines within said scope of said macro reference, further comprising;
means for locating one or more matching macro specifications in said meta data file, wherein said name of said matching macro specification is identical to a reference name used in said macro reference;
means for expanding said lines within said scope of said macro reference using said one or more located specifications; and
means for writing said expanded lines to said output file. - View Dependent Claims (14, 15, 16, 17, 18, 19, 20, 21)
means for detecting an opening macro reference, said opening macro reference specifying said reference name, and wherein said detected opening reference begins said scope of said macro reference;
means for detecting a closing macro reference, wherein said detected closing reference ends said scope of said macro reference; and
wherein said detected opening and closing macro references are not themselves expanded by said means for expanding.
-
-
15. The system according to claim 14, wherein said means for expanding further comprises:
-
means for parsing each of said lines within said scope of said macro reference;
means for copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
means for expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
16. The system according to claim 15, wherein said means for expanding said parsed line further comprises:
-
means for retrieving a corresponding one of said parameter values from said located macro specification using a sequence number from said macro parameter reference; and
means for substituting said retrieved parameter value for said macro parameter reference, wherein said means for retrieving and said means for substituting are repeated for each of said one or more macro parameter references in said parsed line.
-
-
17. The system according to claim 14, wherein said means for expanding further comprises:
-
means for parsing each of said lines within said scope of said macro reference;
means for detecting an opening conditional macro processing statement in said parsed line;
means for evaluating said detected opening conditional macro processing statement;
means for bypassing one or more lines within said scope of said macro reference until detecting an ending conditional macro processing statement when said means for evaluating has a negative result; and
means for expanding one or more of said lines of said input file when said means for evaluating has a positive result, until detecting said ending conditional macro processing statement.
-
-
18. The system according to claim 17, wherein said means for evaluating has said positive result when a condition on said opening conditional macro processing statement evaluates to a Boolean value “
- True”
.
- True”
-
19. The system according to claim 18, wherein said means for evaluating further comprises:
-
means for locating a string value in said condition;
means for retrieving a corresponding condition value from said located macro specification using a conditional parameter sequence number from said condition; and
means for comparing said retrieved corresponding value to said string value.
-
-
20. The system according to claim 19, wherein said means for expanding further comprises:
-
means for parsing each of said lines within said scope of said macro reference;
means for copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
means for expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
21. The system according to claim 20, wherein said means for expanding said parsed line further comprises:
-
means for retrieving a corresponding one of said parameter values from said matching macro specification using a sequence number from said macro parameter reference; and
means for substituting said retrieved parameter value for said macro parameter reference, wherein said means for retrieving and said means for substituting are repeated for each of said one or more macro parameter references in said parsed line.
-
-
22. A method for combining a meta data file and an object-oriented source code input file to create an object-oriented source code output file that will be used to dynamically create objects at compile time in a computing environment, comprising the steps of:
-
creating a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
creating an object-oriented source code input file, wherein said input file comprises a plurality of lines, and wherein each of said lines may be characterized as a normal object-oriented source code statement or as a line within a scope of a macro reference;
copying each of said normal object-oriented source code statements to an object-oriented source code output file; and
processing each of said lines within said scope of said macro reference, further comprising the steps of;
locating one or more matching macro specifications in said meta data file, wherein said name of said matching macro specification is identical to a reference name used in said macro reference;
expanding said lines within said scope of said macro reference using said one or more located specifications; and
writing said expanded lines to said output file. - View Dependent Claims (23, 24, 25, 26, 27, 28, 29, 30, 31)
detecting an opening macro reference, said opening macro reference specifying said reference name, and wherein said detected opening reference begins said scope of said macro reference;
detecting a closing macro reference, wherein said detected closing reference ends said scope of said macro reference; and
wherein said detected opening and closing macro references are not themselves expanded by said expanding step.
-
-
24. The method according to claim 23, wherein said expanding step further comprises the steps of:
-
parsing each of said lines within said scope of said macro reference;
copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
25. The method according to claim 24, wherein said expanding said parsed line step further comprises the steps of:
-
retrieving a corresponding one of said parameter values from said located macro specification using a sequence number from said macro parameter reference; and
substituting said retrieved parameter value for said macro parameter reference, wherein said retrieving step and said substituting step are repeated for each of said one or more macro parameter references in said parsed line.
-
-
26. The method according to claim 23, wherein said expanding step further comprises the steps of:
-
parsing each of said lines within said scope of said macro reference;
detecting an opening conditional macro processing statement in said parsed line;
evaluating said detected opening conditional macro processing statement;
bypassing one or more lines within said scope of said macro reference until detecting an ending conditional macro processing statement when said evaluating step has a negative result; and
expanding one or more lines of said input file when said evaluating step has a positive result, until detecting said ending conditional macro processing statement.
-
-
27. The method according to claim 26, wherein said evaluating step has said positive result when a condition on said opening conditional macro processing statement evaluates to a Boolean value “
- True”
.
- True”
-
28. The method according to claim 27, wherein said evaluating step further comprises the steps of:
-
locating a string value in said condition;
retrieving a corresponding condition value from said located macro specification using a conditional parameter sequence number from said condition; and
comparing said retrieved corresponding value to said string value.
-
-
29. The method according to claim 28, wherein said expanding step further comprises the steps of:
-
parsing each of said lines within said scope of said macro reference;
copying each of said parsed lines which does not contain a macro parameter reference to said output file; and
expanding said parsed line using said located macro specification when said parsed line contains one or more of said macro parameter references.
-
-
30. The method according to claim 29, wherein said expanding said parsed line step further comprises the steps of:
-
retrieving a corresponding one of said parameter values from said matching macro specification using a sequence number from said macro parameter reference; and
substituting said retrieved parameter value for said macro parameter reference, wherein said retrieving step and said substituting step are repeated for each of said one or more macro parameter references in said parsed line.
-
-
31. The method according to claim 22, wherein said object-oriented source code input file and said object-oriented source code output file use the Java programming language.
-
32. A method for combining a meta data file and an object-oriented source code input file to create an object-oriented source code output file that will be used to dynamically create objects at compile time in a computing environment, comprising the steps of:
-
creating a meta data file, wherein said meta data file includes specifications for one or more macros, each of said macro specifications comprising;
a name for a particular macro, wherein said name may be specified in one or more of said macro specifications; and
values for one or more parameters for said particular macro;
creating an object-oriented source code input file, wherein said input file comprises a plurality of lines, selected ones of said lines including one or more macro references; and
creating an object-oriented source code output file by expanding said macro references in said source code input file using corresponding ones of said macro specifications in said meta data file.
-
Specification