org.springframework.data.redis.support.collections
Class RedisProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.springframework.data.redis.support.collections.RedisProperties
All Implemented Interfaces:
Serializable, Cloneable, ConcurrentMap<Object,Object>, Map<Object,Object>, BoundKeyOperations<String>, RedisMap<Object,Object>, RedisStore

public class RedisProperties
extends Properties
implements RedisMap<Object,Object>

Properties extension for a Redis back-store. Useful for reading (and storing) properties inside a Redis hash. Particularly useful inside a Spring container for hooking into Spring's property placeholder or PropertiesFactoryBean.

Note that this implementation only accepts Strings - objects of other type are not supported.

See Also:
Properties, PropertiesLoaderSupport, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
RedisProperties(BoundHashOperations<String,String,String> boundOps)
          Constructs a new RedisProperties instance.
RedisProperties(Properties defaults, BoundHashOperations<String,String,String> boundOps)
          Constructs a new RedisProperties instance.
RedisProperties(Properties defaults, String key, RedisOperations<String,?> operations)
          Constructs a new RedisProperties instance.
RedisProperties(String key, RedisOperations<String,?> operations)
          Constructs a new RedisProperties instance.
 
Method Summary
 void clear()
           
 Object clone()
           
 boolean contains(Object value)
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Enumeration<Object> elements()
           
 Set<Map.Entry<Object,Object>> entrySet()
           
 boolean equals(Object o)
           
 Boolean expire(long timeout, TimeUnit unit)
          Sets the key time-to-live/expiration.
 Boolean expireAt(Date date)
          Sets the key time-to-live/expiration.
 Object get(Object key)
           
 Long getExpire()
          Returns the expiration of this key.
 String getKey()
          Returns the key associated with this entity.
 RedisOperations<String,?> getOperations()
          Returns the underlying Redis operations used by the backing implementation.
 DataType getType()
          Returns the associated Redis type.
 int hashCode()
           
 Double increment(Object key, double delta)
           
 Long increment(Object key, long delta)
           
 boolean isEmpty()
           
 Enumeration<Object> keys()
           
 Set<Object> keySet()
           
 Boolean persist()
          Removes the expiration (if any) of the key.
 Enumeration<?> propertyNames()
           
 Object put(Object key, Object value)
           
 void putAll(Map<? extends Object,? extends Object> t)
           
 Object putIfAbsent(Object key, Object value)
           
 Object remove(Object key)
           
 boolean remove(Object key, Object value)
           
 void rename(String newKey)
          Renames the key.
 Object replace(Object key, Object value)
           
 boolean replace(Object key, Object oldValue, Object newValue)
           
 int size()
           
 void storeToXML(OutputStream os, String comment)
           
 void storeToXML(OutputStream os, String comment, String encoding)
           
 Collection<Object> values()
           
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, save, setProperty, store, store, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
rehash, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RedisProperties

public RedisProperties(BoundHashOperations<String,String,String> boundOps)
Constructs a new RedisProperties instance.


RedisProperties

public RedisProperties(String key,
                       RedisOperations<String,?> operations)
Constructs a new RedisProperties instance.

Parameters:
key -
operations -

RedisProperties

public RedisProperties(Properties defaults,
                       BoundHashOperations<String,String,String> boundOps)
Constructs a new RedisProperties instance.

Parameters:
defaults -
boundOps -

RedisProperties

public RedisProperties(Properties defaults,
                       String key,
                       RedisOperations<String,?> operations)
Constructs a new RedisProperties instance.

Parameters:
defaults -
key -
operations -
Method Detail

get

public Object get(Object key)
Specified by:
get in interface Map<Object,Object>
Overrides:
get in class Hashtable<Object,Object>

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map<Object,Object>
Overrides:
put in class Hashtable<Object,Object>

putAll

public void putAll(Map<? extends Object,? extends Object> t)
Specified by:
putAll in interface Map<Object,Object>
Overrides:
putAll in class Hashtable<Object,Object>

propertyNames

public Enumeration<?> propertyNames()
Overrides:
propertyNames in class Properties

clear

public void clear()
Specified by:
clear in interface Map<Object,Object>
Overrides:
clear in class Hashtable<Object,Object>

clone

public Object clone()
Overrides:
clone in class Hashtable<Object,Object>

contains

public boolean contains(Object value)
Overrides:
contains in class Hashtable<Object,Object>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<Object,Object>
Overrides:
containsKey in class Hashtable<Object,Object>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<Object,Object>
Overrides:
containsValue in class Hashtable<Object,Object>

elements

public Enumeration<Object> elements()
Overrides:
elements in class Hashtable<Object,Object>

entrySet

public Set<Map.Entry<Object,Object>> entrySet()
Specified by:
entrySet in interface Map<Object,Object>
Overrides:
entrySet in class Hashtable<Object,Object>

equals

public boolean equals(Object o)
Specified by:
equals in interface Map<Object,Object>
Overrides:
equals in class Hashtable<Object,Object>

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<Object,Object>
Overrides:
hashCode in class Hashtable<Object,Object>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Object,Object>
Overrides:
isEmpty in class Hashtable<Object,Object>

keys

public Enumeration<Object> keys()
Overrides:
keys in class Hashtable<Object,Object>

keySet

public Set<Object> keySet()
Specified by:
keySet in interface Map<Object,Object>
Overrides:
keySet in class Hashtable<Object,Object>

remove

public Object remove(Object key)
Specified by:
remove in interface Map<Object,Object>
Overrides:
remove in class Hashtable<Object,Object>

size

public int size()
Specified by:
size in interface Map<Object,Object>
Overrides:
size in class Hashtable<Object,Object>

values

public Collection<Object> values()
Specified by:
values in interface Map<Object,Object>
Overrides:
values in class Hashtable<Object,Object>

increment

public Long increment(Object key,
                      long delta)
Specified by:
increment in interface RedisMap<Object,Object>

increment

public Double increment(Object key,
                        double delta)
Specified by:
increment in interface RedisMap<Object,Object>

getOperations

public RedisOperations<String,?> getOperations()
Description copied from interface: RedisStore
Returns the underlying Redis operations used by the backing implementation.

Specified by:
getOperations in interface RedisStore
Returns:
operations

expire

public Boolean expire(long timeout,
                      TimeUnit unit)
Description copied from interface: BoundKeyOperations
Sets the key time-to-live/expiration.

Specified by:
expire in interface BoundKeyOperations<String>
Parameters:
timeout - expiration value
unit - expiration unit
Returns:
true if expiration was set, false otherwise

expireAt

public Boolean expireAt(Date date)
Description copied from interface: BoundKeyOperations
Sets the key time-to-live/expiration.

Specified by:
expireAt in interface BoundKeyOperations<String>
Parameters:
date - expiration date
Returns:
true if expiration was set, false otherwise

getExpire

public Long getExpire()
Description copied from interface: BoundKeyOperations
Returns the expiration of this key.

Specified by:
getExpire in interface BoundKeyOperations<String>
Returns:
expiration value (in seconds)

getKey

public String getKey()
Description copied from interface: BoundKeyOperations
Returns the key associated with this entity.

Specified by:
getKey in interface BoundKeyOperations<String>
Returns:
key associated with the implementing entity

getType

public DataType getType()
Description copied from interface: BoundKeyOperations
Returns the associated Redis type.

Specified by:
getType in interface BoundKeyOperations<String>
Returns:
key type

persist

public Boolean persist()
Description copied from interface: BoundKeyOperations
Removes the expiration (if any) of the key.

Specified by:
persist in interface BoundKeyOperations<String>
Returns:
true if expiration was removed, false otherwise

rename

public void rename(String newKey)
Description copied from interface: BoundKeyOperations
Renames the key.

Specified by:
rename in interface BoundKeyOperations<String>
Parameters:
newKey - new key

putIfAbsent

public Object putIfAbsent(Object key,
                          Object value)
Specified by:
putIfAbsent in interface ConcurrentMap<Object,Object>

remove

public boolean remove(Object key,
                      Object value)
Specified by:
remove in interface ConcurrentMap<Object,Object>

replace

public boolean replace(Object key,
                       Object oldValue,
                       Object newValue)
Specified by:
replace in interface ConcurrentMap<Object,Object>

replace

public Object replace(Object key,
                      Object value)
Specified by:
replace in interface ConcurrentMap<Object,Object>

storeToXML

public void storeToXML(OutputStream os,
                       String comment,
                       String encoding)
                throws IOException
Overrides:
storeToXML in class Properties
Throws:
IOException

storeToXML

public void storeToXML(OutputStream os,
                       String comment)
                throws IOException
Overrides:
storeToXML in class Properties
Throws:
IOException