cacheableint.java

来自「jive 论坛所有的java源码」· Java 代码 · 共 48 行

JAVA
48
字号
/**
 * $RCSfile: CacheableInt.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:09 $
 *
 * New Jive  from Jdon.com.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */

package com.jivesoftware.util;

/**
 * Wrapper for int values so they can be treated as Cacheable objects.
 * Integer is a final class, so it can't be extended.
 */
public class CacheableInt implements Cacheable {

    /**
     * Wrapped int value.
     */
    private int intValue;

    /**
     * Creates a new CacheableInt.
     *
     * @param string the int value to wrap.
     */
    public CacheableInt(int intValue) {
        this.intValue = intValue;
    }

    /**
     * Returns the underlying int value.
     *
     * @return the int value.
     */
    public int getInt() {
        return intValue;
    }

    //FROM THE CACHEABLE INTERFACE//

    public int getSize() {
        return CacheSizes.sizeOfObject() + CacheSizes.sizeOfInt();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?