01: /*
02: * NEMESIS-FORUM.
03: * Copyright (C) 2002 David Laurent(lithium2@free.fr). All rights reserved.
04: *
05: * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
06: *
07: * Copyright (C) 2001 Yasna.com. All rights reserved.
08: *
09: * Copyright (C) 2000 CoolServlets.com. All rights reserved.
10: *
11: * NEMESIS-FORUM. is free software; you can redistribute it and/or
12: * modify it under the terms of the Apache Software License, Version 1.1,
13: * or (at your option) any later version.
14: *
15: * NEMESIS-FORUM core framework, NEMESIS-FORUM backoffice, NEMESIS-FORUM frontoffice
16: * application are parts of NEMESIS-FORUM and are distributed under
17: * same terms of licence.
18: *
19: *
20: * NEMESIS-FORUM includes software developed by the Apache Software Foundation (http://www.apache.org/)
21: * and software developed by CoolServlets.com (http://www.coolservlets.com).
22: * and software developed by Yasna.com (http://www.yasna.com).
23: *
24: */
25:
26: package org.nemesis.forum.util.cache;
27:
28: /**
29: * Wrapper for Integer objects so they can be treated as Cacheable objects.
30: * Integer is a final class, so it can't be extended.
31: */
32: public class CacheableInteger implements Cacheable {
33:
34: /**
35: * Wrapped Integer object.
36: */
37: private Integer integer;
38:
39: /**
40: * Creates a new CacheableInteger.
41: *
42: * @param string the Integer object to wrap.
43: */
44: public CacheableInteger(Integer integer) {
45: this .integer = integer;
46: }
47:
48: /**
49: * Returns the Integer wrapped by the CacheableInteger object.
50: *
51: * @return the Integer object.
52: */
53: public Integer getInteger() {
54: return integer;
55: }
56:
57: //FROM THE CACHEABLE INTERFACE//
58:
59: public int getSize() {
60: return CacheSizes.sizeOfObject() + CacheSizes.sizeOfInt();
61: }
62: }
|