Class GeneratePdusForGivenLanguage
A class that reads an XML file in a specific format, and spits out Java, Python, C#, C++, or Objective-C classes that do most of the work of the generating a DIS protocol API codebase.
In effect, this program is reading an XML file and creating an abstract description for each of the protocol data units (PDUs). That abstract description is written out as source code in various languages, such as Java, Python, C++, etc.
This program can rely on properties set in the XML file for the language. For example, the Java element in the XML file can specify whether JAXB or Hibernate support is included in the generated code.
There is a huge risk of using variable names that have ambiguous meaning here, since many of the terms such as "class" are also used by java or c++. Be careful and scrupulous out there!
- Author:
- Don McGregor, Mike Bailey and Don Brutzman
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The language types we might generate, currently only supporting Javaclass
XML handler for recursively reading information and autogenerating code, namely an inner class that handles the SAX parsing of the XML file. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantprotected Map
<String, GeneratedClass> Contains the database of all the classes described by the XML documentstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constantstatic final String
String constant -
Constructor Summary
ConstructorsConstructorDescriptionGeneratePdusForGivenLanguage
(String xmlDescriptionFileName, String languageToGenerate) Create a new collection of Java objects by reading an XML file; these java objects can be used to generate code templates of any language, once you write the translator for that language. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkArguments
(String xmlFile, String language) Does a sanity check on the args passed in: does the XML file exist, and is the language valid.static void
Entry point: pass in two arguments, the XML file that describes the classes and the programming language API that you want to generate.
-
Field Details
-
INHERITSFROM
String constant- See Also:
-
ALIASFOR
String constant- See Also:
-
IMPLEMENTS
String constant- See Also:
-
XMLROOTELEMENT
String constant- See Also:
-
SISOENUM
String constant- See Also:
-
SISOBITFIELD
String constant- See Also:
-
CLASS
String constant- See Also:
-
ATTRIBUTE
String constant- See Also:
-
COMMENT
String constant- See Also:
-
INITIALVALUE
String constant- See Also:
-
NAME
String constant- See Also:
-
CLASSREF
String constant- See Also:
-
COUNTFIELDNAME
String constant- See Also:
-
TYPE
String constant- See Also:
-
DEFAULTVALUE
String constant- See Also:
-
PRIMITIVE
String constant- See Also:
-
PRIMITIVELIST
String constant- See Also:
-
OBJECTLIST
String constant- See Also:
-
LENGTH
String constant- See Also:
-
FIXEDLENGTH
String constant- See Also:
-
COULDBESTRING
String constant- See Also:
-
TRUE
String constant- See Also:
-
FALSE
String constant- See Also:
-
VALUE
String constant- See Also:
-
SERIALIZE
String constant- See Also:
-
HIDDEN
String constant- See Also:
-
SPECIALCASE
String constant- See Also:
-
PADTOBOUNDARY
String constant- See Also:
-
ABSTRACT
String constant- See Also:
-
JAVA
String constant- See Also:
-
CPP
String constant- See Also:
-
OBJC
String constant- See Also:
-
CSHARP
String constant- See Also:
-
JAVASCRIPT
String constant- See Also:
-
PYTHON
String constant- See Also:
-
FLAG
String constant- See Also:
-
MASK
String constant- See Also:
-
STATICIVAR
String constant- See Also:
-
generatedClassNames
Contains the database of all the classes described by the XML document
-
-
Constructor Details
-
GeneratePdusForGivenLanguage
Create a new collection of Java objects by reading an XML file; these java objects can be used to generate code templates of any language, once you write the translator for that language.- Parameters:
xmlDescriptionFileName
- file namelanguageToGenerate
- programming language (e.g. Java, Python)
-
-
Method Details
-
main
Entry point: pass in two arguments, the XML file that describes the classes and the programming language API that you want to generate.- Parameters:
args
- arguments for xmlfile and programming language
-
checkArguments
Does a sanity check on the args passed in: does the XML file exist, and is the language valid.- Parameters:
xmlFile
- output file namelanguage
- programming language
-