net.sf.beanform.util
Class StringCache

java.lang.Object
  extended by net.sf.beanform.util.StringCache

public class StringCache
extends java.lang.Object

A thread-safe cache of strings that allows aliasing of long strings to smaller strings that can then be used to reverse the process.

Author:
Daniel Gredler

Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> cacheByReal
           
protected  java.util.Map<java.lang.String,java.lang.String> cacheByShort
           
protected static char[] CHARS
           
protected  int maxSize
           
 
Constructor Summary
StringCache(int maxSize)
           
 
Method Summary
protected static java.lang.String getChars(char[] chars, int index)
           
 java.lang.String getRealVersion(java.lang.String shortVersion)
           
 java.lang.String getShortVersion(java.lang.String real)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARS

protected static final char[] CHARS

maxSize

protected int maxSize

cacheByShort

protected java.util.Map<java.lang.String,java.lang.String> cacheByShort

cacheByReal

protected java.util.Map<java.lang.String,java.lang.String> cacheByReal
Constructor Detail

StringCache

public StringCache(int maxSize)
Method Detail

getShortVersion

public java.lang.String getShortVersion(java.lang.String real)

getRealVersion

public java.lang.String getRealVersion(java.lang.String shortVersion)

getChars

protected static java.lang.String getChars(char[] chars,
                                           int index)


Copyright © 2006 Daniel Gredler. All Rights Reserved.