2012/2/22 Simone Tripodi <[email protected]>: > Salut, > >> + if ( request.getExchangeType() == ExchangeType.JSON ) >> + { >> + return writer.generateJsonRequest( request ).getBytes(); >> + } >> + else if ( request.getExchangeType() == >> ExchangeType.JAVA_SERIALIZED_OBJECT ) >> + { >> + try >> + { >> + return request.getSerializer().serialize( >> request.getObject() ); >> + } >> + catch ( IOException e ) >> + { >> + throw new DirectMemoryCacheException( e.getMessage(), e ); >> + } >> + } >> + else if ( request.getExchangeType() == ExchangeType.TEXT_PLAIN ) >> { >> - request.setSerializer( this.configuration.getSerializer() ); >> + log.error( "{} not implemented yet", >> ExchangeType.TEXT_PLAIN.getContentType() ); >> + throw new NotImplementedException();// ); >> + } >> + else >> + { >> + log.error( "exchange type unknown {}", >> request.getExchangeType() ); >> + throw new DirectMemoryCacheException( "exchange type unknown " >> + request.getExchangeType() ); > > would a `switch` be helpful to avoid if-then-else chain? sure. Just done > -Simo > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/
-- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy
