nyla.solutions.global.patterns.cache.CacheFarm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.global Show documentation
Show all versions of nyla.solutions.global Show documentation
Nyla Solutions Global Java API provides support for basic application
utilities (application configuration, data encryption, debugger and text
processing).
The newest version!
package nyla.solutions.global.patterns.cache;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import nyla.solutions.global.exception.NoDataFoundException;
import nyla.solutions.global.exception.NotImplementedException;
import nyla.solutions.global.exception.RequiredException;
public class CacheFarm implements Cache, Cloneable
{
/**
*
* @see java.util.Hashtable#clear()
*/
public void clear()
{
map.clear();
}
/**
* @return
* @see java.util.Hashtable#clone()
*/
public Object clone()
{
/*CacheFarm copy = new CacheFarm();
copy.map = new WeakHashMap();
copy.map.putAll(this.map);
return copy;*/
try
{
return super.clone();
}
catch (CloneNotSupportedException e)
{
throw new RuntimeException(e.getMessage(),e);
}
}
/**
* @param value
* @return
* @see java.util.Hashtable#contains(java.lang.Object)
*/
public boolean contains(Object value)
{
return map.containsValue(value);
}
/**
* @param key
* @return
* @see java.util.Hashtable#containsKey(java.lang.Object)
*/
public boolean containsKey(Object key)
{
return map.containsKey(key);
}
/**
* @param value
* @return
* @see java.util.Hashtable#containsValue(java.lang.Object)
*/
public boolean containsValue(Object value)
{
return map.containsValue(value);
}
/**
* @return
* @see java.util.Hashtable#elements()
*/
public Enumeration elements()
{
throw new NotImplementedException();
}
/**
* @return
* @see java.util.Hashtable#entrySet()
*/
public Set> entrySet()
{
return map.entrySet();
}// --------------------------------------------------------
/**
* @param o
* @return
* @see java.util.Hashtable#equals(java.lang.Object)
*/
public boolean equals(Object o)
{
return map.equals(o);
}
/**
* @param key
* @return
* @see java.util.Hashtable#get(java.lang.Object)
*/
public V get(Object key)
{
return map.get(key);
}
/**
* @return
* @see java.util.Hashtable#hashCode()
*/
public int hashCode()
{
return map.hashCode();
}
/**
* @return
* @see java.util.Hashtable#isEmpty()
*/
public boolean isEmpty()
{
return map.isEmpty();
}
/**
* @return
* @see java.util.Hashtable#keys()
*/
public Enumeration keys()
{
throw new NotImplementedException();
}
/**
* @return
* @see java.util.Hashtable#keySet()
*/
public Set keySet()
{
return map.keySet();
}
/**
* @param arg0
* @param arg1
* @return
* @see java.util.Hashtable#put(java.lang.Object, java.lang.Object)
*/
public V put(K arg0, V arg1)
{
return map.put(arg0, arg1);
}
/**
* @param arg0
* @see java.util.Hashtable#putAll(java.util.Map)
*/
public void putAll(Map extends K, ? extends V> arg0)
{
map.putAll(arg0);
}
/**
* @param key
* @return
* @see java.util.Hashtable#remove(java.lang.Object)
*/
public V remove(Object key)
{
return map.remove(key);
}
/**
* @return
* @see java.util.Hashtable#size()
*/
public int size()
{
return map.size();
}
/**
* @return
* @see java.util.Hashtable#toString()
*/
public String toString()
{
return map.toString();
}
/**
* @return
* @see java.util.Hashtable#values()
*/
public Collection values()
{
return map.values();
}//---------------------------------------------
/**
*
* @return singleton instance cache
*/
public static Cache