All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.holmos.cache.store.CacheStoreMedia Maven / Gradle / Ivy

There is a newer version: 1.0.2u10
Show newest version
package com.holmos.cache.store;

import com.holmos.cache.exception.CacheException;


/**
 * 存储器媒介类型
 * 
 * @author: 吴银龙([email protected])
 * @version: 2013-3-19 下午12:39:33 
 */

public final class CacheStoreMedia {

	/**JVM 内存*/
	public static final CacheStoreMedia MEMORY = new CacheStoreMedia("MEMORY");
	
	/**OFFHEAP 内存*/
	public static final CacheStoreMedia BIGMEMORY = new CacheStoreMedia("BIGMEMORY");
	
	/**DISK 磁盘*/
	public static final CacheStoreMedia DISK = new CacheStoreMedia("DISK");
	
	private static final CacheStoreMedia[] STOREMEDIAS = { MEMORY,BIGMEMORY,DISK };
	private String name;
	
	public CacheStoreMedia(String name){
		this.setName(name);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public static CacheStoreMedia valueOf(String name){
		for (CacheStoreMedia media : STOREMEDIAS ){
			if(media.name.equalsIgnoreCase(name))
				return media;
		}
		throw new CacheException("存储器的名字错误,不存在这种存储器的实现!");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy