org.springframework.data.redis.support.collections
Class AbstractRedisCollection<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by org.springframework.data.redis.support.collections.AbstractRedisCollection<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, BoundKeyOperations<String>, RedisCollection<E>, RedisStore
Direct Known Subclasses:
DefaultRedisList, DefaultRedisSet, DefaultRedisZSet

public abstract class AbstractRedisCollection<E>
extends AbstractCollection<E>
implements RedisCollection<E>

Base implementation for RedisCollection. Provides a skeletal implementation.


Field Summary
static String ENCODING
           
 
Constructor Summary
AbstractRedisCollection(String key, RedisOperations<String,E> operations)
           
 
Method Summary
abstract  boolean add(E e)
           
 boolean addAll(Collection<? extends E> c)
           
abstract  void clear()
           
 boolean containsAll(Collection<?> c)
           
 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.
 Long getExpire()
          Returns the expiration of this key.
 String getKey()
          Returns the key associated with this entity.
 RedisOperations<String,E> getOperations()
          Returns the underlying Redis operations used by the backing implementation.
 int hashCode()
           
 Boolean persist()
          Removes the expiration (if any) of the key.
abstract  boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 void rename(String newKey)
          Renames the key.
 boolean retainAll(Collection<?> c)
           
 String toString()
           
 
Methods inherited from class java.util.AbstractCollection
contains, isEmpty, iterator, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
getType
 

Field Detail

ENCODING

public static final String ENCODING
See Also:
Constant Field Values
Constructor Detail

AbstractRedisCollection

public AbstractRedisCollection(String key,
                               RedisOperations<String,E> operations)
Method Detail

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

getOperations

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

Specified by:
getOperations in interface RedisStore
Returns:
operations

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Overrides:
addAll in class AbstractCollection<E>

add

public abstract boolean add(E e)
Specified by:
add in interface Collection<E>
Overrides:
add in class AbstractCollection<E>

clear

public abstract void clear()
Specified by:
clear in interface Collection<E>
Overrides:
clear in class AbstractCollection<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Overrides:
containsAll in class AbstractCollection<E>

remove

public abstract boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Overrides:
remove in class AbstractCollection<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Overrides:
removeAll in class AbstractCollection<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Overrides:
retainAll in class AbstractCollection<E>

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<E>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<E>
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class AbstractCollection<E>

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)

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