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
-
ALIASFOR
-
IMPLEMENTS
-
XMLROOTELEMENT
-
SISOENUM
-
SISOBITFIELD
-
CLASS
-
ATTRIBUTE
-
COMMENT
-
INITIALVALUE
-
NAME
-
CLASSREF
-
COUNTFIELDNAME
-
TYPE
-
DEFAULTVALUE
-
PRIMITIVE
-
PRIMITIVELIST
-
OBJECTLIST
-
LENGTH
-
FIXEDLENGTH
-
COULDBESTRING
-
TRUE
-
FALSE
-
VALUE
-
SERIALIZE
-
HIDDEN
-
SPECIALCASE
-
PADTOBOUNDARY
-
ABSTRACT
-
JAVA
-
CPP
-
OBJC
-
CSHARP
-
JAVASCRIPT
-
PYTHON
-
FLAG
-
MASK
-
STATICIVAR
-
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
-