private void appendPortableWriter ( JMessage < ? > message ) { writer . appendln ( "@Override" ) . formatln ( "public void writePortable(%s %s) throws %s {" , PortableWriter . class . getName ( ) , PORTABLE_WRITER , IOException . class . getName ( ) ) . begin ( ) ; // TODO: This should be short[] instead, as field IDs are restricted to 16bit. writer . appendln ( "int[] setFields = presentFields().stream()" ) . appendln ( " .mapToInt(_Field::getId)" ) . appendln ( " .toArray();" ) . appendln ( "portableWriter.writeIntArray(\"__fields__\", setFields);" ) ; for ( JField field : message . declaredOrderFields ( ) ) { if ( ! field . alwaysPresent ( ) ) { writer . formatln ( "if( %s() ) {" , field . isSet ( ) ) . begin ( ) ; } writePortableField ( field ) ; if ( ! field . alwaysPresent ( ) ) { writer . end ( ) . appendln ( "} else {" ) . begin ( ) ; writeDefaultPortableField ( field ) ; writer . end ( ) . appendln ( "}" ) ; } } writer . end ( ) . appendln ( "}" ) . newline ( ) ; }
Method to append writePortable from hazelcast_portable .