Example usage for org.springframework.integration.redis.support RedisHeaders MAP_KEY

List of usage examples for org.springframework.integration.redis.support RedisHeaders MAP_KEY

Introduction

In this page you can find the example usage for org.springframework.integration.redis.support RedisHeaders MAP_KEY.

Prototype

String MAP_KEY

To view the source code for org.springframework.integration.redis.support RedisHeaders MAP_KEY.

Click Source Link

Usage

From source file:org.springframework.integration.redis.outbound.RedisCollectionPopulatingMessageHandler.java

private Object assertMapEntry(Message<?> message, boolean property) {
    Object mapKey = this.mapKeyExpression.getValue(this.evaluationContext, message);
    Assert.notNull(mapKey, "Can not determine a map key for the entry. The key is determined by evaluating "
            + "the 'mapKeyExpression' property.");
    Object payload = message.getPayload();
    if (property) {
        Assert.isInstanceOf(String.class, mapKey, "For property, key must be a String");
        Assert.isInstanceOf(String.class, payload, "For property, payload must be a String");
    }// www.  j a va 2  s .  c om
    Assert.isTrue(mapKey != null,
            "Failed to determine the key for the " + "Redis Map entry. Payload is not a Map and '"
                    + RedisHeaders.MAP_KEY + "' header is not provided");
    return mapKey;
}

From source file:org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler.java

private Object determineMapKey(Message<?> message, boolean property) {
    Object mapKey = this.mapKeyExpression.getValue(this.evaluationContext, message);
    Assert.notNull(mapKey, "Cannot determine a map key for the entry. The key is determined by evaluating "
            + "the 'mapKeyExpression' property.");
    if (property) {
        Assert.isInstanceOf(String.class, mapKey, "For property, key must be a String");
    }//  ww  w.  ja v  a2  s . co m
    Assert.isTrue(mapKey != null,
            "Failed to determine the key for the " + "Redis Map entry. Payload is not a Map and '"
                    + RedisHeaders.MAP_KEY + "' header is not provided");
    return mapKey;
}