private void appendPortableReader ( JMessage < ? > message ) { writer . appendln ( "@Override" ) . formatln ( "public void readPortable(%s %s) throws %s {" , PortableReader . class . getName ( ) , PORTABLE_READER , IOException . class . getName ( ) ) . begin ( ) ; // TODO: This should be short[] instead, as field IDs are restricted to 16bit. writer . formatln ( "int[] field_ids = %s.readIntArray(\"__fields__\");" , PORTABLE_READER ) . appendln ( ) . appendln ( "for (int id : field_ids) {" ) . begin ( ) . appendln ( "switch (id) {" ) . begin ( ) ; for ( JField field : message . declaredOrderFields ( ) ) { writer . formatln ( "case %d: {" , field . id ( ) ) . begin ( ) ; readPortableField ( field ) ; writer . appendln ( "break;" ) . end ( ) . appendln ( "}" ) ; } writer . end ( ) . appendln ( "}" ) // switch . end ( ) . appendln ( "}" ) // for loop . end ( ) . appendln ( "}" ) // readPortable . newline ( ) ; }
Method to append readPortable from hazelcast_portable .