com.thoughtworks.xstream.persistence
Class AbstractFilePersistenceStrategy

java.lang.Object
  extended by com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy
All Implemented Interfaces:
PersistenceStrategy
Direct Known Subclasses:
FilePersistenceStrategy, FileStreamStrategy

public abstract class AbstractFilePersistenceStrategy
extends Object
implements PersistenceStrategy

Abstract base class for file based persistence strategies.

Since:
1.3.1
Author:
Guilherme Silveira, Joerg Schaible

Nested Class Summary
protected  class AbstractFilePersistenceStrategy.ValidFilenameFilter
           
protected  class AbstractFilePersistenceStrategy.XmlMapEntriesIterator
           
 
Constructor Summary
AbstractFilePersistenceStrategy(File baseDirectory, XStream xstream, String encoding)
           
 
Method Summary
 boolean containsKey(Object key)
           
protected abstract  Object extractKey(String name)
          Given a filename, the unescape method returns the key which originated it.
 Object get(Object key)
           
protected  ConverterLookup getConverterLookup()
           
protected  Mapper getMapper()
           
protected abstract  String getName(Object key)
          Given a key, the escape method returns the filename which shall be used.
protected  boolean isValid(File dir, String name)
           
 Iterator iterator()
           
 Object put(Object key, Object value)
           
 Object remove(Object key)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFilePersistenceStrategy

public AbstractFilePersistenceStrategy(File baseDirectory,
                                       XStream xstream,
                                       String encoding)
Method Detail

getConverterLookup

protected ConverterLookup getConverterLookup()

getMapper

protected Mapper getMapper()

isValid

protected boolean isValid(File dir,
                          String name)

extractKey

protected abstract Object extractKey(String name)
Given a filename, the unescape method returns the key which originated it.

Parameters:
name - the filename
Returns:
the original key

getName

protected abstract String getName(Object key)
Given a key, the escape method returns the filename which shall be used.

Parameters:
key - the key
Returns:
the desired and escaped filename

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface PersistenceStrategy

iterator

public Iterator iterator()
Specified by:
iterator in interface PersistenceStrategy

size

public int size()
Specified by:
size in interface PersistenceStrategy

containsKey

public boolean containsKey(Object key)

get

public Object get(Object key)
Specified by:
get in interface PersistenceStrategy

remove

public Object remove(Object key)
Specified by:
remove in interface PersistenceStrategy


Copyright © 2004-2014 XStream. All Rights Reserved.