1 /*
2 * Copyright 1999,2004-2005 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.catalina.cluster.util;
18
19 /**
20 * The class <b>LinkObject</b> implements an element
21 * for a linked list, consisting of a general
22 * data object and a pointer to the next element.
23 *
24 * @author Rainer Jung
25 * @author Peter Rossbach
26 * @version $Revision: 304032 $ $Date: 2005-07-27 11:11:55 -0400 (Wed, 27 Jul 2005) $
27
28 */
29
30 public class LinkObject {
31
32 private Object payload;
33 private LinkObject next;
34 private String key ;
35
36 /**
37 * Construct a new element from the data object.
38 * Sets the pointer to null.
39 *
40 * @param key The key
41 * @param payload The data object.
42 */
43 public LinkObject(String key,Object payload) {
44 this.payload = payload;
45 this.next = null;
46 this.key = key ;
47 }
48
49 /**
50 * Set the next element.
51 * @param next The next element.
52 */
53 public void append(LinkObject next) {
54 this.next = next;
55 }
56
57 /**
58 * Get the next element.
59 * @return The next element.
60 */
61 public LinkObject next() {
62 return next;
63 }
64
65 /**
66 * Get the data object from the element.
67 * @return The data object from the element.
68 */
69 public Object data() {
70 return payload;
71 }
72
73 /**
74 * Get the unique message id
75 * @return the unique message id
76 */
77 public Object getKey() {
78 return key;
79 }
80
81 }