Example usage for org.springframework.data.redis.connection RedisConnectionFactory getClass

List of usage examples for org.springframework.data.redis.connection RedisConnectionFactory getClass

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnectionFactory getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.gopivotal.cloudfoundry.test.core.RedisUtils.java

public String getUrl(RedisConnectionFactory redisConnectionFactory) {
    if (isClass(redisConnectionFactory, "com.gopivotal.cloudfoundry.test.core.FakeRedisConnectionFactory")) {
        return "redis://fake";
    } else if (isClass(redisConnectionFactory,
            "org.springframework.data.redis.connection.jedis" + ".JedisConnectionFactory")) {
        org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory = (org.springframework.data.redis.connection.jedis.JedisConnectionFactory) redisConnectionFactory;
        String host = jedisConnectionFactory.getHostName();
        int port = jedisConnectionFactory.getPort();

        return String.format("redis://%s:%d", host, port);
    }/*from ww  w.  j a  v a  2  s .co m*/

    return String.format("Unable to determine URL for RedisConnectionFactory of type %s",
            redisConnectionFactory.getClass().getName());
}