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 java.lang.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(java.io.File baseDirectory, XStream xstream, java.lang.String encoding)
           
 
Method Summary
 boolean containsKey(java.lang.Object key)
           
protected abstract  java.lang.Object extractKey(java.lang.String name)
          Given a filename, the unescape method returns the key which originated it.
 java.lang.Object get(java.lang.Object key)
           
protected  ConverterLookup getConverterLookup()
           
protected  Mapper getMapper()
           
protected abstract  java.lang.String getName(java.lang.Object key)
          Given a key, the escape method returns the filename which shall be used.
protected  boolean isValid(java.io.File dir, java.lang.String name)
           
 java.util.Iterator iterator()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.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(java.io.File baseDirectory,
                                       XStream xstream,
                                       java.lang.String encoding)
Method Detail

getConverterLookup

protected ConverterLookup getConverterLookup()

getMapper

protected Mapper getMapper()

isValid

protected boolean isValid(java.io.File dir,
                          java.lang.String name)

extractKey

protected abstract java.lang.Object extractKey(java.lang.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 java.lang.String getName(java.lang.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 java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface PersistenceStrategy

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface PersistenceStrategy

size

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

containsKey

public boolean containsKey(java.lang.Object key)

get

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

remove

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


Copyright © 2004-2011 XStream. All Rights Reserved.