没办法,不过可以参考jive的实现方法:public interface Cacheable { public int getSize(); } public class CacheableLong implements Cacheable { /** * Wrapped long object. */ private long longValue; /** * Creates a new CacheableLong. * * @param string the Long object to wrap. */ public CacheableLong(long longValue) { this.longValue = longValue; } /** * Returns the Long wrapped by the CacheableLong object. * * @return the Long object. */ public long getLong() { return longValue; } //FROM THE CACHEABLE INTERFACE// public int getSize() { return CacheSizes.sizeOfLong(); } }
public int getSize();
}
public class CacheableLong implements Cacheable {
/**
* Wrapped long object.
*/
private long longValue; /**
* Creates a new CacheableLong.
*
* @param string the Long object to wrap.
*/
public CacheableLong(long longValue) {
this.longValue = longValue;
} /**
* Returns the Long wrapped by the CacheableLong object.
*
* @return the Long object.
*/
public long getLong() {
return longValue;
} //FROM THE CACHEABLE INTERFACE// public int getSize() {
return CacheSizes.sizeOfLong();
}
}
都是累加到的.