|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.acplt.oncrpc.apps.jrpcgen.JavaSourceGenerator
public class JavaSourceGenerator
Field Summary | |
---|---|
java.lang.String |
baseClassname
Name of class containing global constants. |
static org.apache.maven.plugin.logging.Log |
log
The logger. |
Constructor Summary | |
---|---|
JavaSourceGenerator()
|
Method Summary | |
---|---|
org.acplt.oncrpc.apps.jrpcgen.JrpcgenEnDecodingInfo |
baseEnDecodingSyllable(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl)
Return the en-/decoding syllable XXX appropriate for a base data type including arrays of base data types. |
java.lang.String |
checkForEnumValue(java.lang.String value)
Checks whether a given value references an identifier and then returns the qualified identifier (interface where the value is defined in) or simply the value in case of an integer literal. |
java.lang.String |
checkForSpecials(java.lang.String dataType)
Checks whether a given data type identifier refers to an enumeration type and then returns Java's int data type instead. |
void |
closeJavaSourceFile(java.io.PrintWriter writer)
Closes the source code file previously opened with createJavaSourceFile . |
java.lang.String |
codingMethod(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl,
boolean encode)
Return en- or decoding method appropriate for a struct or union member. |
java.lang.String |
codingMethod(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl,
boolean encode,
java.lang.String oref)
Return en- or decoding method appropriate for a struct or union member. |
java.io.PrintWriter |
createJavaSourceFile(java.lang.String classname)
Creates a new source code file for a Java class based on its class name. |
java.io.PrintWriter |
createJavaSourceFile(java.lang.String classname,
boolean emitImports)
Creates a new source code file for a Java class based on its class name. |
org.acplt.oncrpc.apps.jrpcgen.JrpcgenSHA |
createSHA(java.lang.String classname)
Create a new hash function object and initialize it using a class and package name. |
void |
doParse()
The real parsing and code generation part. |
void |
dumpClasses()
Generate source code files for all structures, unions and enumerations as well as constants. |
void |
dumpClient(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProgramInfo programInfo)
Generate source code for the client stub proxy object. |
void |
dumpClientStubMethods(org.acplt.oncrpc.apps.jrpcgen.JrpcgenVersionInfo versionInfo,
java.io.PrintWriter writer)
Generate source code for client-side stub methods for a particular remote program version. |
void |
dumpConstantAndDependency(org.acplt.oncrpc.apps.jrpcgen.JrpcgenConst c)
Dump the value of a constant and optionally first dump all constants it depends on. |
void |
dumpConstants()
Generate source code file containing all constants defined in the x-file as well as all implicitely defined constants, like program, version and procedure numbers, etc. |
void |
dumpEnum(org.acplt.oncrpc.apps.jrpcgen.JrpcgenEnum e)
Generate a source code file containing all elements of an enumeration defined in a x-file. |
void |
dumpFiles(java.util.Hashtable glIdentifiers)
Create the source code files based on the parsed information from the x-file. |
void |
dumpServer(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProgramInfo programInfo)
|
void |
dumpServerStubMethodCall(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProcedureInfo proc,
java.io.PrintWriter writer)
|
void |
dumpServerStubMethods(org.acplt.oncrpc.apps.jrpcgen.JrpcgenVersionInfo versionInfo,
java.io.PrintWriter writer)
Generate public abstract method signatures for all remote procedure calls. |
void |
dumpStruct(org.acplt.oncrpc.apps.jrpcgen.JrpcgenStruct s)
Generate a source code file containing all elements of a struct defined in a x-file. |
void |
dumpTypedef(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration d)
Generate a source code file containing a wrapper class for a typedef defined in a x-file. |
void |
dumpUnion(org.acplt.oncrpc.apps.jrpcgen.JrpcgenUnion u)
Generate a source code file containing all elements of a union defined in a x-file. |
void |
dumpUnionClasses(org.acplt.oncrpc.apps.jrpcgen.JrpcgenUnion u)
|
boolean |
isVisitorUsesReflection()
|
void |
setAdditionalImports(java.util.List<java.lang.String> additionalImports)
|
void |
setDestinationDir(java.io.File destinationDir)
|
void |
setEnumType(java.lang.String enumType)
|
void |
setMakeBean(boolean makeBean)
|
void |
setMakeSerializable(boolean makeSerializable)
|
void |
setNoBackups(boolean noBackups)
|
void |
setOneClassForUnions(boolean oneCLassForUnions)
|
void |
setPackageName(java.lang.String packageName)
|
void |
setSuperClassName(java.lang.String superClassName)
|
void |
setUseXdrStream(boolean useXdrStream)
|
void |
setVerbose(boolean verbose)
|
void |
setVersionString(java.lang.String versionString)
|
void |
setVisitorName(java.lang.String visitorName)
|
void |
setVisitorUsesReflection(boolean visitorUsesReflection)
|
void |
setXFile(java.io.File file)
|
static java.lang.String |
xdrBaseType(java.lang.String type)
Given a name of a data type return the name of the equivalent Java data type (if it exists), otherwise return null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static org.apache.maven.plugin.logging.Log log
public java.lang.String baseClassname
Constructor Detail |
---|
public JavaSourceGenerator()
Method Detail |
---|
public java.io.PrintWriter createJavaSourceFile(java.lang.String classname)
createJavaSourceFile(String, boolean)
with
the emitImport
parameter set to true
.
classname
- Name of Java class to generate. Must not contain
a file extension -- especially ".java" is invalid. When the source
code file is created, ".java" is appended automatically.
public java.io.PrintWriter createJavaSourceFile(java.lang.String classname, boolean emitImports)
classname
- Name of Java class to generate. Must not contain
a file extension -- especially ".java" is invalid. When the source
code file is created, ".java" is appended automatically.emitImports
- if true
, then import statements for
the remotetea ONC/RPC package and IOExceptions.
public org.acplt.oncrpc.apps.jrpcgen.JrpcgenSHA createSHA(java.lang.String classname)
classname
- Name of class.
public void closeJavaSourceFile(java.io.PrintWriter writer)
createJavaSourceFile
. This method writes a trailer
before closing the file.
public void dumpConstantAndDependency(org.acplt.oncrpc.apps.jrpcgen.JrpcgenConst c)
public void dumpConstants()
public void dumpEnum(org.acplt.oncrpc.apps.jrpcgen.JrpcgenEnum e)
e
- Description
of XDR enumeration.public static java.lang.String xdrBaseType(java.lang.String type)
null
.
NOTE: "opaque" is considered like "byte" to be a base type...
FIXME: char/byte?
null
if the
given data type is not equivalent to one of Java's base data
types.public org.acplt.oncrpc.apps.jrpcgen.JrpcgenEnDecodingInfo baseEnDecodingSyllable(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl)
decl
- declaration of a member of RPC struct or union.
null
, if the declaration does not specify a base data
type. Otherwise a three-element String array, with [0] containing
the type syllable for base type (including arrays), [1] containing
parameter options when encoding (like maximum sizes, etc), and [2]
containing options for decoding.public java.lang.String codingMethod(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl, boolean encode)
public java.lang.String codingMethod(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration decl, boolean encode, java.lang.String oref)
decl
- declaration for which the en-/decoding Java source code be
returned.encode
- true
if encoding method should be returned,
false
if decoding method is to be returned.oref
- name of object reference or null
if
"this" should be used instead.public java.lang.String checkForSpecials(java.lang.String dataType)
dataType
- data type identifier to check.
public java.lang.String checkForEnumValue(java.lang.String value)
value
- Either an identifier to resolve or an integer literal.
public void dumpStruct(org.acplt.oncrpc.apps.jrpcgen.JrpcgenStruct s)
s
- Description
of XDR struct.public void dumpUnionClasses(org.acplt.oncrpc.apps.jrpcgen.JrpcgenUnion u)
public void dumpUnion(org.acplt.oncrpc.apps.jrpcgen.JrpcgenUnion u)
u
- Description
of XDR union.public void dumpTypedef(org.acplt.oncrpc.apps.jrpcgen.JrpcgenDeclaration d)
d
- Description
of XDR typedef.public void dumpClasses()
public void dumpClientStubMethods(org.acplt.oncrpc.apps.jrpcgen.JrpcgenVersionInfo versionInfo, java.io.PrintWriter writer)
versionInfo
- Information about the remote program version for
which source code is to be generated.public void dumpClient(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProgramInfo programInfo)
public void dumpServerStubMethodCall(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProcedureInfo proc, java.io.PrintWriter writer)
public void dumpServerStubMethods(org.acplt.oncrpc.apps.jrpcgen.JrpcgenVersionInfo versionInfo, java.io.PrintWriter writer)
public void dumpServer(org.acplt.oncrpc.apps.jrpcgen.JrpcgenProgramInfo programInfo)
public void dumpFiles(java.util.Hashtable glIdentifiers)
public void doParse() throws java.io.FileNotFoundException, java.lang.Exception
java.io.FileNotFoundException
java.lang.Exception
public void setPackageName(java.lang.String packageName)
packageName
- the packageName to setpublic void setMakeBean(boolean makeBean)
makeBean
- the makeBean to setpublic void setVisitorName(java.lang.String visitorName)
visitorName
- the visitorName to setpublic void setSuperClassName(java.lang.String superClassName)
superClassName
- the superClassName to setpublic void setDestinationDir(java.io.File destinationDir)
destinationDir
- the destinationDir to setpublic void setVerbose(boolean verbose)
verbose
- the verbose to setpublic void setNoBackups(boolean noBackups)
noBackups
- the noBackups to setpublic void setXFile(java.io.File file)
file
- the xFile to setpublic void setMakeSerializable(boolean makeSerializable)
makeSerializable
- the makeSerializable to setpublic void setVersionString(java.lang.String versionString)
versionString
- the versionString to setpublic void setAdditionalImports(java.util.List<java.lang.String> additionalImports)
additionalImports
- the additionalImports to setpublic boolean isVisitorUsesReflection()
public void setVisitorUsesReflection(boolean visitorUsesReflection)
visitorUsesReflection
- the visitorUsesReflection to setpublic void setOneClassForUnions(boolean oneCLassForUnions)
oneClassForUnions
- the oneClassForUnions to setpublic void setUseXdrStream(boolean useXdrStream)
useXdrStream
- the useXdrStream to setpublic void setEnumType(java.lang.String enumType)
enumType
- the enumType to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |