Enum Class JrpcgenBaseType
- All Implemented Interfaces:
Serializable,Comparable<JrpcgenBaseType>,Constable,JrpcgenTypeMapping
- Author:
- Harald Wirths <hwirths@nde.ag>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic JrpcgenBaseTypegetBaseType(String type) Returns the base type mapping to the passed type name as given in an x-file.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 name of the Java type mapped to the XDR type identified by the definition name.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.static booleanisBaseType(String type) Returns whether the passed type name labels one of the base types defined by this enumeration.static booleanReturns whether the passed type name equals the definition name of the base typebool.final booleanReturns whether this base type maps the typeboolean.static booleanReturns whether the passed type name equals the definition name of the base typechar.static booleanReturns whether the passed type name equals the definition name of the base typedouble.static booleanReturns whether the passed type name equals the definition name of the base typefloat.static booleanReturns whether the passed type name equals the definition name of the base typehyper.static booleanReturns whether the passed type name equals the definition name of the base typeint.static booleanReturns whether the passed type name equals the definition name of the base typeopaque.final booleanReturns whether this base type maps the typeopaque.static booleanisPrimitive(String type) Returns whether the passed type name labels the definition name of one of the primitive typesbool,char,short,int,hyper,floatordouble.static booleanReturns whether the passed type name equals the definition name of the base typeshort.static booleanReturns whether the passed type name equals the definition name of the base typeString.final booleanReturns whether this base type maps the typeString.final booleanisVoid()Returns whether this base type maps the typevoid.static booleanReturns whether the passed type name equals the definition name of the base typevoid.static JrpcgenBaseTypeReturns the enum constant of this class with the specified name.static JrpcgenBaseType[]values()Returns an array containing the constants of this enum class, in the order they are declared.writeCodingMethodStem(JrpcgenJavaFile javaFile, String xdrStream, String codingType, String typeSpecifier) Writes the coding method stem for the mapped base type.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.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.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.voidwriteXdrConstructorCall(JrpcgenJavaFile javaFile, String parameter) A constructor call based on the XDR class of the mapped base type is written to the passed Java file.voidwriteXdrConstructorCall(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression parameterExpression) A cosntuctor call based on the XDR class of the mapped base type is written to the passed Java file.voidwriteXdrDecodingCall(JrpcgenJavaFile javaFile, String xdrStream) Writes an XDR decoding call to the passed Java file using the passed name of an XDR decoding stream.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.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.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.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.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.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.voidwriteXdrToJava(JrpcgenJavaFile javaFile, String result) 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.
-
Enum Constant Details
-
VOID
-
BOOL
-
CHAR
-
SHORT
-
INT
-
HYPER
-
FLOAT
-
DOUBLE
-
STRING
-
OPAQUE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isVoid
Returns whether the passed type name equals the definition name of the base typevoid.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typevoid,falseotherwise.
-
isBoolean
Returns whether the passed type name equals the definition name of the base typebool.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typebool,falseotherwise.
-
isChar
Returns whether the passed type name equals the definition name of the base typechar.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typechar,falseotherwise.
-
isShort
Returns whether the passed type name equals the definition name of the base typeshort.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typeshort,falseotherwise.
-
isInt
Returns whether the passed type name equals the definition name of the base typeint.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typeint,falseotherwise.
-
isHyper
Returns whether the passed type name equals the definition name of the base typehyper.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typehyper,falseotherwise.
-
isFloat
Returns whether the passed type name equals the definition name of the base typefloat.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typefloat,falseotherwise.
-
isDouble
Returns whether the passed type name equals the definition name of the base typedouble.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typedouble,falseotherwise.
-
isString
Returns whether the passed type name equals the definition name of the base typeString.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typeString,falseotherwise.
-
isOpaque
Returns whether the passed type name equals the definition name of the base typeopaque.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name equals the definition name of the base typeopaque,falseotherwise.
-
isPrimitive
Returns whether the passed type name labels the definition name of one of the primitive typesbool,char,short,int,hyper,floatordouble.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name labels one of the mentioned primitive types,falseotherwise.
-
isBaseType
Returns whether the passed type name labels one of the base types defined by this enumeration.- Parameters:
type- The type name to check.- Returns:
truein case the passed type name labels one of the base types defined by this enumeration,falseotherwise.
-
getBaseType
Returns the base type mapping to the passed type name as given in an x-file. One of the following will be returned:- Type name void :
JrpcgenBaseType.VOID - Type name bool :
JrpcgenBaseType.BOOL - Type name char :
JrpcgenBaseType.CHAR - Type name short :
JrpcgenBaseType.SHORT - Type name int :
JrpcgenBaseType.INT - Type name hyper :
JrpcgenBaseType.HYPER - Type name float :
JrpcgenBaseType.FLOAT - Type name double :
JrpcgenBaseType.DOUBLE - Type name string :
JrpcgenBaseType.STRING - Type name opaque :
JrpcgenBaseType.OPAQUE
- Parameters:
type- The name of the requested base type.- Returns:
- The corresponding base type mapping or
null.
- Type name void :
-
isVoid
public final boolean isVoid()Returns whether this base type maps the typevoid.- Specified by:
isVoidin interfaceJrpcgenTypeMapping- Returns:
truein case this is the mapping for typevoid,falseotherwise.
-
isBaseType
public final boolean isBaseType()Returns whether the mapped type belongs to the family of the base types. Each type mapping of this enumeration belongs to one of the base types andtrueis returned, always.- Specified by:
isBaseTypein interfaceJrpcgenTypeMapping- Returns:
true
-
isBooleanType
public final boolean isBooleanType()Returns whether this base type maps the typeboolean.- Specified by:
isBooleanTypein interfaceJrpcgenTypeMapping- Returns:
truein case this is the mapping for typeboolean…,falseotherwise.
-
isStringType
public final boolean isStringType()Returns whether this base type maps the typeString.- Specified by:
isStringTypein interfaceJrpcgenTypeMapping- Returns:
truein case this base type maps the typeString,falseotherwise.
-
isOpaqueType
public final boolean isOpaqueType()Returns whether this base type maps the typeopaque.- Specified by:
isOpaqueTypein interfaceJrpcgenTypeMapping- Returns:
truein case this base type maps the typeopaque,falseotherwise.
-
getDefinitionName
Returns the definition name of the mapped type in the x-file.JrpcgenBaseType.VOIDreturns the name void.JrpcgenBaseType.BOOLreturns the name boolJrpcgenBaseType.CHARreturns the name charJrpcgenBaseType.SHORTreturns the name shortJrpcgenBaseType.INTreturns the name intJrpcgenBaseType.HYPERreturns the name hyperJrpcgenBaseType.FLOATreturns the name floatJrpcgenBaseType.DOUBLEreturns the name doubleJrpcgenBaseType.STRINGreturns the name stringJrpcgenBaseType.OPAQUEreturns the name opaque
- Specified by:
getDefinitionNamein interfaceJrpcgenTypeMapping- Returns:
- The definition name of this base type as described above.
-
getJavaName
Returns the name of the Java type mapped to the XDR type identified by the definition name. The returned value depends on the mapped base type and will be one of the following:voidfor the base type mappingJrpcgenBaseType.VOID.booleanfor the base type mappingJrpcgenBaseType.BOOL.bytefor the base type mappingJrpcgenBaseType.CHAR.shortfor the base type mappingJrpcgenBaseType.SHORT.intfor the base type mappingJrpcgenBaseType.INT.longfor the base type mappingJrpcgenBaseType.HYPER.floatfor the base type mappingJrpcgenBaseType.FLOAT.doublefor the base type mappingJrpcgenBaseType.DOUBLE.Stringfor the base type mappingJrpcgenBaseType.STRING.bytefor the base type mappingJrpcgenBaseType.OPAQUE.
- Specified by:
getJavaNamein interfaceJrpcgenTypeMapping- Returns:
- The Java name of the mapped type.
-
getJavaClass
Returns the name of the Java class belonging to the mapped type. The returned value depends on the mapped base type and will be one of the following:Voidfor the base type mappingJrpcgenBaseType.VOID.Booleanfor the base type mappingJrpcgenBaseType.BOOL.Bytefor the base type mappingJrpcgenBaseType.CHAR.Shortfor the base type mappingJrpcgenBaseType.SHORT.Integerfor the base type mappingJrpcgenBaseType.INT.Longfor the base type mappingJrpcgenBaseType.HYPER.Floatfor the base type mappingJrpcgenBaseType.FLOAT.Doublefor the base type mappingJrpcgenBaseType.DOUBLE.Stringfor the base type mappingJrpcgenBaseType.STRING.Bytefor the base type mappingJrpcgenBaseType.OPAQUE.
- Specified by:
getJavaClassin interfaceJrpcgenTypeMapping- Returns:
- The mapped Java class name for this base type as described above.
-
getXdrClass
Returns the name of the XDR class providing the coding methods of the mapped type, in detail the class implementing the interfacefor the mapped type. The returned value depends on the mapped base type and will be one of the following:invalid reference
XdrAble-
for the base type mapping
invalid reference
XdrVoidJrpcgenBaseType.VOID. -
for the base type mapping
invalid reference
XdrBooleanJrpcgenBaseType.BOOL. -
for the base type mapping
invalid reference
XdrByteJrpcgenBaseType.CHAR. -
for the base type mapping
invalid reference
XdrShortJrpcgenBaseType.SHORT. -
for the base type mapping
invalid reference
XdrIntJrpcgenBaseType.INT. -
for the base type mapping
invalid reference
XdrLongJrpcgenBaseType.HYPER. -
for the base type mapping
invalid reference
XdrFloatJrpcgenBaseType.FLOAT. -
for the base type mapping
invalid reference
XdrDoubleJrpcgenBaseType.DOUBLE. -
for the base type mapping
invalid reference
XdrStringJrpcgenBaseType.STRING. -
for the base type mapping
invalid reference
XdrOpaqueJrpcgenBaseType.OPAQUE.
- Specified by:
getXdrClassin interfaceJrpcgenTypeMapping- Returns:
- The name of the XDR class implementing the coding methods for the mapped type.
-
-
writeXdrConstructorCall
A constructor call based on the XDR class of the mapped base type is written to the passed Java file. Dependent on the passed parameter the constructor call becomes a call without a parameter or with one parameter.This applies to all base types except for the base type
JrpcgenBaseType.VOID. The base typeJrpcgenBaseType.VOIDwill return a reference to the global instanceXdrVoid.XDR_VOID, always. As this type does not hold a value, a passed parameter different fromnullwill be ignored.- 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 void writeXdrConstructorCall(JrpcgenJavaFile javaFile, JrpcgenJavaFile.Expression parameterExpression) A cosntuctor call based on the XDR class of the mapped base 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.This applies to all base types except for the base type
JrpcgenBaseType.VOID. The base typeJrpcgenBaseType.VOIDwill return a reference to the global instanceXdrVoid.XDR_VOID, always. As this type does not hold a value, the passed parameter expression will be ignored.- Specified by:
writeXdrConstructorCallin interfaceJrpcgenTypeMapping- Parameters:
javaFile- 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.
-
writeJavaToXdr
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. With base types an XDR constructor call will be placed into the Java file, where the passed variable will be placed as parameter to the constructor call.- 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.- See Also:
-
writeJavaToXdr
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. With base types an XDR constructor call will be placed into the Java file, where the passed expression will form the parameter to the constructor call.- 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.- See Also:
-
writeXdrToJava
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.This applies to all base types except for the base type
JrpcgenBaseType.VOID. No statement is written for this type, becaus the XDR classdoes not hold any value.invalid reference
XdrVoid- Specified by:
writeXdrToJavain interfaceJrpcgenTypeMapping- Parameters:
javaFile- The Java file, where the conversion statement is going to be placed.result- The name of a variable in XDR representation.variable- The name of a variable in XDR representation.
-
writeXdrEncodingCall
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. The referenced variable is expected to represent a value of the mapped type.This applies to all base types except for the following base types:
JrpcgenBaseType.VOID: This type does not support any coding as it does represent no value.JrpcgenBaseType.STRING: This type does not support coding in a scalar context.JrpcgenBaseType.OPAQUE: This type does not support coding in a scalar context.
- 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 void writeXdrEncodingCall(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. The result of the passed expression is expected to represent a value of the mapped type.This applies to all base types except for the following base types:
JrpcgenBaseType.VOID: This type does not support any coding as it does represent no value.JrpcgenBaseType.STRING: This type does not support coding in a scalar context.JrpcgenBaseType.OPAQUE: This type does not support coding in a scalar context.
- 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 void writeXdrFixedVectorEncodingCall(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. The rerferenced variable is expected to repesent an array of the mapped type.This applies to all base types except for the following base types:
JrpcgenBaseType.VOID: This type does not support any coding as it does represent no value.JrpcgenBaseType.STRING: This type does not support coding in a fixed vector context.
- 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 void writeXdrDynamicVectorEncodingCall(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. The referenced variable is expected to repesent an array of the mapped type.This applies to all base types except for the base type
JrpcgenBaseType.VOID, which does not support any coding as it does represent no value. Consequently, nothing is written to the passed Java file by this method for the base typeJrpcgenBaseType.VOID.- 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
Writes an XDR decoding call to the passed Java file using the passed name of an XDR decoding stream.This applies to all base types except for the following base types:
JrpcgenBaseType.VOID: This type does not support any coding as it does represent no value.JrpcgenBaseType.STRING: This type does not support coding in a scalar context.JrpcgenBaseType.OPAQUE: This type does not support coding in a scalar context.
- 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 void writeXdrFixedVectorDecodingCall(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.This applies to all base types except for the following base types:
JrpcgenBaseType.VOID: This type does not support any coding as it does represent no value.JrpcgenBaseType.STRING: This type does not support coding in a fixed vector context.
- 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
Writes an XDR decoding call for a dynamic vector to the passed Java file using the passed name of an XDR decoding stream.This applies to all base types except for the base type
JrpcgenBaseType.VOID, which does not support any coding as it does represent no value. Consequently, nothing is written to the passed Java file by this method for the base typeJrpcgenBaseType.VOID.- 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 void writeEqualsExpression(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. The negate parameter controls whether the statement evaluates totrueon equality or on inequality.This applies to all base types except for the base type
JrpcgenBaseType.VOID, for which nothing is written to the passed Java file by ths method.- 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.
-
writeCodingMethodStem
public JrpcgenJavaFile writeCodingMethodStem(JrpcgenJavaFile javaFile, String xdrStream, String codingType, String typeSpecifier) Writes the coding method stem for the mapped base type.- Parameters:
javaFile- The Java file where the method stem is going to be placed.xdrStream- The name of the XDR coding stream.codingType- The coding type to use, xdrEncode or xdrDecode in most of the cases.typeSpecifier- The type specifier to append to the coding type, either the Java name or the definition name in most of the cases.- Returns:
- The passed Java file.
-