private void appendCreateMethod ( List < CStructDescriptor > messages ) { writer . appendln ( "@Override" ) . formatln ( "public %s create(int classId) {" , Portable . class . getName ( ) ) . begin ( ) . appendln ( "switch(classId) {" ) . begin ( ) ; for ( CStructDescriptor message : messages ) { writer . formatln ( "case %s: {" , getHazelcastClassId ( message . getName ( ) ) ) . begin ( ) . formatln ( "return new %s.%s();" , message . getName ( ) , HazelcastPortableMessageFormatter . WRAPPER_CLASS_NAME ) . end ( ) . appendln ( "}" ) ; } writer . appendln ( "default: {" ) . begin ( ) . appendln ( "return null;" ) . end ( ) . appendln ( "}" ) . end ( ) ; writer . appendln ( "}" ) . end ( ) . appendln ( "}" ) . newline ( ) ; }
Method to write the create method from implemented PortableFactory