public static String getMappedTypeSize ( FieldInfo field , int order , FieldType type , boolean isList , boolean isMap , boolean debug , File path ) { String fieldName = getFieldName ( order ) ; String spath = "null" ; if ( path != null ) { spath = "new java.io.File(\"" + path . getAbsolutePath ( ) . replace ( ' ' , ' ' ) + "\")" ; } String typeString = type . getType ( ) . toUpperCase ( ) ; if ( isList ) { return "CodedConstant.computeListSize(" + order + ", " + fieldName + ", FieldType." + typeString + ", " + Boolean . valueOf ( debug ) + ", " + spath + "," + Boolean . valueOf ( field . isPacked ( ) ) + ")" + CodeGenerator . JAVA_LINE_BREAK ; } else if ( isMap ) { String joinedSentence = getMapFieldGenericParameterString ( field ) ; return "CodedConstant.computeMapSize(" + order + ", " + fieldName + ", " + joinedSentence + ")" + CodeGenerator . JAVA_LINE_BREAK ; } if ( type == FieldType . OBJECT ) { return "CodedConstant.computeSize(" + order + "," + fieldName + ", FieldType." + typeString + "," + Boolean . valueOf ( debug ) + "," + spath + ")" + CodeGenerator . JAVA_LINE_BREAK ; } String t = type . getType ( ) ; if ( type == FieldType . STRING || type == FieldType . BYTES ) { t = "bytes" ; } t = capitalize ( t ) ; boolean enumSpecial = false ; if ( type == FieldType . ENUM ) { if ( EnumReadable . class . isAssignableFrom ( field . getField ( ) . getType ( ) ) ) { String clsName = ClassHelper . getInternalName ( field . getField ( ) . getType ( ) . getCanonicalName ( ) ) ; fieldName = "((" + clsName + ") " + fieldName + ").value()" ; enumSpecial = true ; } } if ( ! enumSpecial ) { fieldName = fieldName + type . getToPrimitiveType ( ) ; } return "com.google.protobuf.CodedOutputStream.compute" + t + "Size(" + order + "," + fieldName + ")" + CodeGenerator . JAVA_LINE_BREAK ; }
Gets the mapped type size .