incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1292536 - in /incubator/directmemory/trunk/server: ./ directmemory-server-client/ directmemory-server-client/src/main/java/org/apache/directmemory/server/client/ directmemory-server-commons/src/main/java/org/apache/directmemory/serve
Date Wed, 22 Feb 2012 22:11:20 GMT
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?
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
Mime
View raw message