Package org.acplt.oncrpc.apps.jrpcgen
Class JrpcgenTypeInfo
java.lang.Object
org.acplt.oncrpc.apps.jrpcgen.JrpcgenTypeInfo
- All Implemented Interfaces:
JrpcgenTypeMapping
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidgenerateCodingSupplement(JrpcgenContext context) final StringReturns the definition name of the mapped type in the x-file.final StringReturns the name of the Java class belonging to the mapped type.final StringReturns the Java name of the mapped type.static JrpcgenTypeInfogetTypeInfo(JrpcgenContext context, String type) final StringReturns the name of the XDR class providing the coding methods of the mapped type, in detail the class implementing the interfacefor the mapped type.invalid reference
XdrAblefinal booleanReturns whether the mapped type belongs to the family of the base types.final booleanReturns whether the mapped type isboolean.final booleanReturns whether the mapped type isopaque.final booleanReturns whether the mapped type isString.final booleanisVoid()Returns whether the mapped type isvoid.final voidwriteEqualsExpression(JrpcgenJavaFile javaFile, String variableLeft, String variableRight, boolean negate) Writes an equals expression to the passed Java file using the passed names of a left hand side and a right hand side variable.final voidwriteJavaToXdr(JrpcgenJavaFile javaFile, String variable) Writes a conversion statement to the passed Java file changing the Java representation of a variable to the corresponding XDR representation, in order to enable XDR encoding operations on the referenced variable.final voidwriteJavaToXdr(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression expression) Writes a conversion statement to the passed Java file changing the Java representation resulting from the passed expression to the corresponding XDR representation, in order to enable XDR encoding operations on the result of the passed expression.final voidwriteXdrConstructorCall(JrpcgenJavaFile javaFile, String parameter) A constructor call based on the XDR class of the mapped type is written to the passed Java file.final voidwriteXdrConstructorCall(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression parameterExpression) A constructor call based on the XDR class of the mapped type is written to the passed Java file.final voidwriteXdrDecodingCall(JrpcgenJavaFile javaFile, String xdrStream) Writes an XDR decoding call to the passed Java file using the passed name of an XDR decoding stream.final voidwriteXdrDynamicVectorDecodingCall(JrpcgenJavaFile javaFile, String xdrStream) Writes an XDR decoding call for a dynamic vector to the passed Java file using the passed name of an XDR decoding stream.final voidwriteXdrDynamicVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable) Writes an XDR encoding call for a dynamic vector to the passed Java file using the passed name of an XDR encoding stream and the passed name of a variable.final voidwriteXdrEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable) Writes an XDR encoding call to the passed Java file using the passed name of an XDR encoding stream and the passed name of a variable.final voidwriteXdrEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, JrpcgenJavaFile.Expression expression) Writes an XDR encoding call to the passed Java file using the passed name of an XDR encoding stream and the result of the passed experssion.final voidwriteXdrFixedVectorDecodingCall(JrpcgenJavaFile javaFile, String xdrStream, String size) Writes an XDR decoding call for a fixed vector to the passed Java file using the passed name of an XDR decoding stream and the passed size.final voidwriteXdrFixedVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable, String size) Writes an XDR encoding call for a fixed vector to the passed Java file using the passed name of an XDR encoding stream, the passed name of a variable and the passed size.final voidwriteXdrToJava(JrpcgenJavaFile javaFile, String variable) Writes a conversion statement to the passed Java file changing the XDR representation of a variable to the corresponding Java representation, which takes place after XDR decoding operations.
-
Method Details
-
getTypeInfo
-
generateCodingSupplement
-
isVoid
public final boolean isVoid()Description copied from interface:JrpcgenTypeMappingReturns whether the mapped type isvoid.- Specified by:
isVoidin interfaceJrpcgenTypeMapping- Returns:
truein case the mapped type isvoid,falseotherwise.
-
isBaseType
public final boolean isBaseType()Description copied from interface:JrpcgenTypeMappingReturns whether the mapped type belongs to the family of the base types. Base types are:voidbooleanbyteshortintlongfloatdoubleStringopaque
.invalid reference
JrpgenBaseType- Specified by:
isBaseTypein interfaceJrpcgenTypeMapping- Returns:
truein case the mapped type belongs to the family of base types,falseotherwise.
-
isBooleanType
public final boolean isBooleanType()Description copied from interface:JrpcgenTypeMappingReturns whether the mapped type isboolean.- Specified by:
isBooleanTypein interfaceJrpcgenTypeMapping- Returns:
truein case the mapped type isboolean,falseotherwise.
-
isStringType
public final boolean isStringType()Description copied from interface:JrpcgenTypeMappingReturns whether the mapped type isString.- Specified by:
isStringTypein interfaceJrpcgenTypeMapping- Returns:
truein case the mapped type isString,falseotherwise.
-
isOpaqueType
public final boolean isOpaqueType()Description copied from interface:JrpcgenTypeMappingReturns whether the mapped type isopaque.- Specified by:
isOpaqueTypein interfaceJrpcgenTypeMapping- Returns:
truein case the mapped type isopaque,falseotherwise.
-
getDefinitionName
Description copied from interface:JrpcgenTypeMappingReturns the definition name of the mapped type in the x-file.- Specified by:
getDefinitionNamein interfaceJrpcgenTypeMapping- Returns:
- The definition name of the mapped type.
-
getJavaName
Description copied from interface:JrpcgenTypeMappingReturns the Java name of the mapped type.- Specified by:
getJavaNamein interfaceJrpcgenTypeMapping- Returns:
- The Java name of the mapped type.
-
getJavaClass
Description copied from interface:JrpcgenTypeMappingReturns the name of the Java class belonging to the mapped type. The returned value will be equal to the Java name of the mapped type, if the mapped type is a Java class. For types mapped to Java primitives likeint, this method is expected to return the name of the wrapper class to the Java primitive.- Specified by:
getJavaClassin interfaceJrpcgenTypeMapping- Returns:
- The name of the Java class representing the mapped type.
-
getXdrClass
Description copied from interface:JrpcgenTypeMappingReturns the name of the XDR class providing the coding methods of the mapped type, in detail the class implementing the interfacefor the mapped type. For base types the returned value will be one of the provided XDR classes of the ONC/RPC runtime library. For enumerations the returned value depends on the given value to the flag noEnum. However, the returned value identifies an XDR class provided by the ONC/RPC runtime library, in detail eitherinvalid reference
XdrAblewith flag noEnum set toinvalid reference
XdrInttrueorwith flag noEnum set toinvalid reference
XdrEnumfalse. For other complex types the returned value will be equal to the Java name and Java class, respectively.- Specified by:
getXdrClassin interfaceJrpcgenTypeMapping- Returns:
- The name of the XDR class implementing the coding methods for the mapped type.
-
writeXdrConstructorCall
Description copied from interface:JrpcgenTypeMappingA constructor call based on the XDR class of the mapped type is written to the passed Java file. Dependent on the passed parameter the constructor call becomes a call without a parameter or one parameter.- Specified by:
writeXdrConstructorCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the XDR constructor call is going to be placed.parameter-nullto generate a default constructor call, a parameter name to generate a constructor call with one parameter.
-
writeXdrConstructorCall
public final void writeXdrConstructorCall(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression parameterExpression) Description copied from interface:JrpcgenTypeMappingA constructor call based on the XDR class of the mapped type is written to the passed Java file. The parameter expression is intended to write an expression, which evaluates to a parameter to the constructor call.- Specified by:
writeXdrConstructorCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the constuctor 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.
-
writeJavaToXdr
Description copied from interface:JrpcgenTypeMappingWrites a conversion statement to the passed Java file changing the Java representation of a variable to the corresponding XDR representation, in order to enable XDR encoding operations on the referenced variable.- Specified by:
writeJavaToXdrin interfaceJrpcgenTypeMapping- Parameters:
javaFile- The java file, where the converison statement is going to be placed.variable- The name of a variable in Java representation.
-
writeJavaToXdr
Description copied from interface:JrpcgenTypeMappingWrites a conversion statement to the passed Java file changing the Java representation resulting from the passed expression to the corresponding XDR representation, in order to enable XDR encoding operations on the result of the passed expression.- Specified by:
writeJavaToXdrin interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the conversion statement is going to be placed.expression- An expression to be called with the passed Java file, when the expression is going to be placed in the Java file.
-
writeXdrToJava
Description copied from interface:JrpcgenTypeMappingWrites a conversion statement to the passed Java file changing the XDR representation of a variable to the corresponding Java representation, which takes place after XDR decoding operations.- Specified by:
writeXdrToJavain interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the conversion statement is going to be placed.variable- The name of a variable in XDR representation.
-
writeXdrEncodingCall
Description copied from interface:JrpcgenTypeMappingWrites an XDR encoding call to the passed Java file using the passed name of an XDR encoding stream and the passed name of a variable. The referenced variable is expected to represent a value of the mapped type.- Specified by:
writeXdrEncodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeXdrEncodingCall
public final void writeXdrEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, JrpcgenJavaFile.Expression expression) Description copied from interface:JrpcgenTypeMappingWrites an XDR encoding call to the passed Java file using the passed name of an XDR encoding stream and the result of the passed experssion. The result of the passed expression is expected to represent a value of the mapped type.- Specified by:
writeXdrEncodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the XDR encoding code 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.
-
writeXdrFixedVectorEncodingCall
public final void writeXdrFixedVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable, String size) Description copied from interface:JrpcgenTypeMappingWrites an XDR encoding call for a fixed vector to the passed Java file using the passed name of an XDR encoding stream, the passed name of a variable and the passed size. The rerferenced variable is expected to repesent an array of the mapped type.- Specified by:
writeXdrFixedVectorEncodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.size- A string specifying the size of the fixed vector.
-
writeXdrDynamicVectorEncodingCall
public final void writeXdrDynamicVectorEncodingCall(JrpcgenJavaFile javaFile, String xdrStream, String variable) Description copied from interface:JrpcgenTypeMappingWrites an XDR encoding call for a dynamic vector to the passed Java file using the passed name of an XDR encoding stream and the passed name of a variable. The referenced variable is expected to represent an array of the mapped type.- Specified by:
writeXdrDynamicVectorEncodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeXdrDecodingCall
Description copied from interface:JrpcgenTypeMappingWrites an XDR decoding call to the passed Java file using the passed name of an XDR decoding stream.- Specified by:
writeXdrDecodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeXdrFixedVectorDecodingCall
public final void writeXdrFixedVectorDecodingCall(JrpcgenJavaFile javaFile, String xdrStream, String size) Description copied from interface:JrpcgenTypeMappingWrites an XDR decoding call for a fixed vector to the passed Java file using the passed name of an XDR decoding stream and the passed size.- Specified by:
writeXdrFixedVectorDecodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeXdrDynamicVectorDecodingCall
Description copied from interface:JrpcgenTypeMappingWrites an XDR decoding call for a dynamic vector to the passed Java file using the passed name of an XDR decoding stream.- Specified by:
writeXdrDynamicVectorDecodingCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeEqualsExpression
public final void writeEqualsExpression(JrpcgenJavaFile javaFile, String variableLeft, String variableRight, boolean negate) Description copied from interface:JrpcgenTypeMappingWrites an equals expression to the passed Java file using the passed names of a left hand side and a right hand side variable. The negate parameter controls whether the statement evaluates totrueon equality or on inequality.- Specified by:
writeEqualsExpressionin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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-falseto let the resulting statement returntrueon equality,trueto let the resulting statement returntrueon inequality.
-