KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nemesis > forum > util > cache > CacheableInteger


1 /*
2  * NEMESIS-FORUM.
3  * Copyright (C) 2002 David Laurent(lithium2@free.fr). All rights reserved.
4  *
5  * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
6  *
7  * Copyright (C) 2001 Yasna.com. All rights reserved.
8  *
9  * 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
27 package org.nemesis.forum.util.cache;
28
29 /**
30  * Wrapper for Integer objects so they can be treated as Cacheable objects.
31  * Integer is a final class, so it can't be extended.
32  */

33 public class CacheableInteger implements Cacheable {
34
35     /**
36      * Wrapped Integer object.
37      */

38     private Integer JavaDoc integer;
39
40     /**
41      * Creates a new CacheableInteger.
42      *
43      * @param string the Integer object to wrap.
44      */

45     public CacheableInteger(Integer JavaDoc integer) {
46         this.integer = integer;
47     }
48
49     /**
50      * Returns the Integer wrapped by the CacheableInteger object.
51      *
52      * @return the Integer object.
53      */

54     public Integer JavaDoc getInteger() {
55         return integer;
56     }
57
58     //FROM THE CACHEABLE INTERFACE//
59

60     public int getSize() {
61         return CacheSizes.sizeOfObject() + CacheSizes.sizeOfInt();
62     }
63 }
64
Popular Tags