protected static Renderer changeMediaType ( final Renderer r , final MediaType mt ) { return new Renderer ( ) { @ Override public MediaType getMediaType ( Bindings unused ) { return mt ; } @ Override public BytesOut render ( Times t , Bindings rc , Map < String , String > termBindings , APIResultSet results ) { return r . render ( t , rc , termBindings , results ) ; } @ Override public String getPreferredSuffix ( ) { return r . getPreferredSuffix ( ) ; } @ Override public CompleteContext . Mode getMode ( ) { return r . getMode ( ) ; } } ; }
Given a renderer r and a media type mt return a new renderer which behaves like r except that it announces its media type as mt . r itself is not changed .