public abstract class JrpcgenComplexType extends JrpcgenXdrDefinition implements JrpcgenTypeMapping
XdrAble to
provide the required coding methods for the mapped complex type.generateJavaFile(), which will write
the implementation of the Java class.JrpcgenXdrDefinition within this
library.JrpcgenXdrDefinition.Table, JrpcgenXdrDefinition.Typedocumentation| Constructor and Description |
|---|
JrpcgenComplexType(String identifier,
JrpcgenXdrDefinition.Type type)
Constructs a complex type with the identifier and the type specifier passed.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
generateJavaFile()
Concrete implementations are asked to generate a Java file
containing an implementation of the Java class mapping
the complex type.
|
String |
getDefinitionName()
Returns the identifier of the complex type.
|
String |
getJavaClass()
The complex type is mapped by a Java class.
|
String |
getJavaName()
The Java name is equal to the definition name
and therefore equal to the identifier of the complex
type.
|
String |
getXdrClass()
The Java class mapping the complex type usually implements
the interface
XdrAble. |
boolean |
isBaseType()
A complex type cannot be a base type at the same time.
|
boolean |
isBooleanType()
A complex type is always different from the type
boolean. |
boolean |
isOpaqueType()
A complex type is always different from the type
opaque. |
boolean |
isStringType()
A complex type is always different from the type
String. |
boolean |
isVoid()
A complex type is always different from the type
void. |
void |
writeEqualsExpression(JrpcgenJavaFile javaFile,
String variableLeft,
String variableRight,
boolean negate)
Writes an equals expression to the passed Java file using the passed names of the left hand side
and the right hand side variable.
|
void |
writeJavaToXdr(JrpcgenJavaFile javaFile,
JrpcgenJavaFile.Expression expression)
Wirtes the passed expression to the passed Java file.
|
void |
writeJavaToXdr(JrpcgenJavaFile javaFile,
String variable)
At this level of a complex type the passed variable represents both the
Java as well as the XDR representation and will be written as is to the
passed Java file.
|
void |
writeXdrConstructorCall(JrpcgenJavaFile javaFile,
JrpcgenJavaFile.Expression parameterExpression)
Writes a constructor call with the XDR class provided by this mapping.
|
void |
writeXdrConstructorCall(JrpcgenJavaFile javaFile,
String parameter)
Writes a default constructor call or a constructor call with one parameter
with the XDR class provided by this mapping.
|
void |
writeXdrDecodingCall(JrpcgenJavaFile javaFile,
String xdrStream)
Writes an XDR encoding call on the result of the passed expression with the passed name of an XDR
decoding stream to the passed Java file.
|
void |
writeXdrDynamicVectorDecodingCall(JrpcgenJavaFile javaFile,
String xdrStream)
Writes an XDR decoding call for a dynamic vector of the mapping type to the passed Java file.
|
void |
writeXdrDynamicVectorEncodingCall(JrpcgenJavaFile javaFile,
String xdrStream,
String variable)
Writes an XDR encoding call for a dynamic vector of the mapping type to the passed Java file.
|
void |
writeXdrEncodingCall(JrpcgenJavaFile javaFile,
String xdrStream,
JrpcgenJavaFile.Expression expression)
Writes an XDR encoding call on the result of the passed expression with the passed name of an XDR
encoding stream to the passed Java file.
|
void |
writeXdrEncodingCall(JrpcgenJavaFile javaFile,
String xdrStream,
String variable)
Writes an XDR encoding call on the passed variable with the passed name of an XDR encoding
stream to the passed Java file.
|
void |
writeXdrFixedVectorDecodingCall(JrpcgenJavaFile javaFile,
String xdrStream,
String size)
Writes an XDR decoding call for a fixed vector of the mapping type to the passed Java file.
|
void |
writeXdrFixedVectorEncodingCall(JrpcgenJavaFile javaFile,
String xdrStream,
String variable,
String size)
Writes an XDR encoding call for a fixed vector of the mapping type to the passed Java file.
|
void |
writeXdrToJava(JrpcgenJavaFile javaFile,
String variable)
At this level of a complex type the passed variable represents both the
Java as well as the XDR representation and will be written as is to the
passed Java file.
|
void |
writeXdrVectorCodingMethods(JrpcgenJavaFile javaFile,
JrpcgenContext context)
Writes static encoding and decoding methods for fixed and dynamic vectors of the mapping
to the passed Java file.
|
getIdentifier, getXdrType, isConst, isEnum, isStruct, isTypedef, isUnionappendDeprecatedOrNothing, appendDeprecatedOrNothing, documentationIsEmpty, documentationIsProvided, emptyDocumentation, getDocumentation, getIdentedDocu, getIdentedDocu, isDeprecated, writeDocumentation, writeDocumentationpublic JrpcgenComplexType(String identifier, JrpcgenXdrDefinition.Type type)
identifier - The identifier of the complex type.type - The type specifier of the complex type, which will be one of
JrpcgenXdrDefinition.Type.ENUMJrpcgenXdrDefinition.Type.STRUCTJrpcgenXdrDefinition.Type.UNIONJrpcgenXdrDefinition.Type.TYPEDEFpublic abstract void generateJavaFile()
public final boolean isVoid()
void.isVoid in interface JrpcgenTypeMappingfalse, always.public final boolean isBaseType()
isBaseType in interface JrpcgenTypeMappingfalse, always.public final boolean isBooleanType()
boolean.isBooleanType in interface JrpcgenTypeMappingfalse, always.public final boolean isStringType()
String.isStringType in interface JrpcgenTypeMappingfalse, always.public final boolean isOpaqueType()
opaque.isOpaqueType in interface JrpcgenTypeMappingfalse, always.public String getDefinitionName()
getDefinitionName in interface JrpcgenTypeMappingpublic String getJavaName()
getJavaName in interface JrpcgenTypeMappingpublic String getJavaClass()
getJavaClass in interface JrpcgenTypeMappingpublic String getXdrClass()
XdrAble. Therefore the name of the XDR
class is equal to the definition name and the identifier of
the complex type, respectively.getXdrClass in interface JrpcgenTypeMappingpublic void writeXdrConstructorCall(JrpcgenJavaFile javaFile, String parameter)
null as value of
the parameter parameter will result in a default constructor call
written to the passed Java file. Otherwise the value of the parameter
parameter will be written as parameter to the constuctor call.writeXdrConstructorCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the constructor call is going to be placed.parameter - null to generate a default constructor call, a parameter
name to generate a constructor call with one parameter.public void writeXdrConstructorCall(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression parameterExpression)
writeXdrConstructorCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the constructor call is going to be placed.parameterExpression - An expression to be called with the passed Java file,
when the expression is going to be placed in the Java file.public void writeJavaToXdr(JrpcgenJavaFile javaFile, String variable)
writeJavaToXdr in interface JrpcgenTypeMappingjavaFile - The Java file, where the variable is going to be placed.variable - The name of a variable in Java representation.public void writeJavaToXdr(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression expression)
writeJavaToXdr in interface JrpcgenTypeMappingjavaFile - The Java file, where the passed expression is going to be placed.expression - An expression to be called with the passed Java file.public void writeXdrToJava(JrpcgenJavaFile javaFile, String variable)
writeXdrToJava in interface JrpcgenTypeMappingjavaFile - The Java file, where the result is going to be placed.variable - The name of a variable in XDR representation.public void writeXdrEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable)
XdrAble and therefore the XDR encoding call will be
similar to variable.xdrEncode(xdrStream).writeXdrEncodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR encoding call is going to be placed.xdrStream - The name of the XDR encoding stream instance to be used in the statement.variable - The name of the variable to be used in the statement.public void writeXdrEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, JrpcgenJavaFile.Expression expression)
XdrAble. Therefore
the XDR encoding call will be similar to expression.xdrEncode(xdrStream).writeXdrEncodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR encoding call is going to be placed.xdrStream - The name of the XDR encoding stream instance to be used in the statement.expression - An expression to be called with the passed Java file, when the
expression is going to be placed in the Java file.public void writeXdrFixedVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable, String size)
xdrEncodeFixedVector(XdrEncodingStream, MappingType, int)
in the generated code of the mapping type MappingType as done by a call to the method
writeXdrVectorCodingMethods(JrpcgenJavaFile, JrpcgenContext) within the implementation
of the method generateJavaFile(). Thereby MappingType is a placeholder
for the name of concrete mapping type at this point.writeXdrFixedVectorEncodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR encoding call is going to be placed.xdrStream - The name of the XDR encoding instance to be used in the statement.variable - The name of the variable to be used in the statement.size - A string specifying the size of the fixed vector.public void writeXdrDynamicVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable)
xdrEncodeDynamicVector(XdrEncodingStream, MappingType) in the generated code of the
mapping type as done by a call to the method
#wirteXdrVectorCodingMethods(JrpcgenJavaFile, JrpcgenContext) within the
implementation of the method generateJavaFile(). Thereby MappingType
is a placeholder for the name of the concrete mapping type at this point.writeXdrDynamicVectorEncodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR encoding call is going to be placed.xdrStream - The name of the XDR encoding instance to be used in the statement.variable - The name of the variable to be used in the statement.public void writeXdrDecodingCall(JrpcgenJavaFile javaFile, String xdrStream)
XdrAble and therefore the XDR decoding call will be similar to
an constructor call with the name of the XDR decoding stream as parameter.writeXdrDecodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR decoding call is going to be placed.xdrStream - The name of the XDR decoding stream instance to be used in the statement.public void writeXdrFixedVectorDecodingCall(JrpcgenJavaFile javaFile, String xdrStream, String size)
xdrDecodeFixedVector(XdrDecodingStream, int) within the implementation
of the generated code of the mapping type MappingType as done by a call to the method
writeXdrVectorCodingMethods(JrpcgenJavaFile, JrpcgenContext) within the implementation
of the method generateJavaFile(). Thereby MappingType is a placeholder
for the name of the concrete mapping type at this point.writeXdrFixedVectorDecodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR decoding call is going to be placed.xdrStream - The name of the XDR decoding stream instance to be used in the statement.size - A string specifying the size of the fixed vector.public void writeXdrDynamicVectorDecodingCall(JrpcgenJavaFile javaFile, String xdrStream)
xdrDecodeDynamicVector(XdrDecodingStream)
in the generated code of the mapping type as done by a call to method
writeXdrVectorCodingMethods(JrpcgenJavaFile, JrpcgenContext) within the implementation
of the method generateJavaFile().writeXdrDynamicVectorDecodingCall in interface JrpcgenTypeMappingjavaFile - The Java file, where the XDR decoding call is going to be placed.xdrStream - The name of the XDR decoding stream instance to be used in the statement.public void writeEqualsExpression(JrpcgenJavaFile javaFile, String variableLeft, String variableRight, boolean negate)
true on equality or on inequality. At this level of complex types the
generated code will be similar to
java.utils.Objects.equals(variableLeft, variableRight)for
negate=false and
! java.utils.Objects.equals(variableLeft, variableRight)for
negate=true.writeEqualsExpression in interface JrpcgenTypeMappingjavaFile - The Java file, where the equality expression is going to be placed.variableLeft - The name of the variable to be used as the left hand side in the statement.variableRight - The name of the variable to be used as the right hand side in the statement.negate - false to let the resulting statement return true on equality,
true to let the resulting statement return true on inequality.public void writeXdrVectorCodingMethods(JrpcgenJavaFile javaFile, JrpcgenContext context)
However, the static encoding and decoding methods for fixed and dynamic vectors of the mapping type will be written only if they are required as a result of the foregoing parsing process. During the parsing phase vector uses of the mapping type are recognized and stored in maps for types in fixed and dynamic vector uses, respectively. The rules of generation are as follows:
javaFile - The Java file, where the static methods are going to be placed.context - The context of the current jrpcgen run.Copyright © 2025. All rights reserved.