1 package org.apache.commons.jcs.engine;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.jcs.engine.behavior.ICacheElementSerialized;
23 import org.apache.commons.jcs.engine.behavior.IElementAttributes;
24
25 import java.util.Arrays;
26
27
28 public class CacheElementSerialized<K, V>
29 extends CacheElement<K, V>
30 implements ICacheElementSerialized<K, V>
31 {
32
33 private static final long serialVersionUID = -7265084818647601874L;
34
35
36 private final byte[] serializedValue;
37
38
39
40
41
42
43
44
45
46 public CacheElementSerialized( String cacheNameArg, K keyArg, byte[] serializedValueArg,
47 IElementAttributes elementAttributesArg )
48 {
49 super(cacheNameArg, keyArg, null, elementAttributesArg);
50 this.serializedValue = serializedValueArg;
51 }
52
53
54 @Override
55 public byte[] getSerializedValue()
56 {
57 return this.serializedValue;
58 }
59
60
61
62
63
64
65 @Override
66 public String toString()
67 {
68 StringBuilder buf = new StringBuilder();
69 buf.append( "\n CacheElementSerialized: " );
70 buf.append( "\n CacheName = [" + getCacheName() + "]" );
71 buf.append( "\n Key = [" + getKey() + "]" );
72 buf.append( "\n SerializedValue = " + Arrays.toString(getSerializedValue()) );
73 buf.append( "\n ElementAttributes = " + getElementAttributes() );
74 return buf.toString();
75 }
76
77 }