01: /*
02: * $Id: NullPayload.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.transport;
12:
13: import java.io.ObjectStreamException;
14: import java.io.Serializable;
15:
16: /**
17: * <code>NullPayload</code> represents a null event payload
18: */
19: // @Immutable
20: public final class NullPayload implements Serializable {
21: /**
22: * Serial version
23: */
24: private static final long serialVersionUID = 3530905899811505080L;
25:
26: private static class NullPayloadHolder {
27: private static final NullPayload instance = new NullPayload();
28: }
29:
30: public static NullPayload getInstance() {
31: return NullPayloadHolder.instance;
32: }
33:
34: private NullPayload() {
35: super ();
36: }
37:
38: private Object readResolve() throws ObjectStreamException {
39: return NullPayloadHolder.instance;
40: }
41:
42: // @Override
43: public boolean equals(Object obj) {
44: return obj instanceof NullPayload;
45: }
46:
47: // @Override
48: public int hashCode() {
49: return 1; // random, 0 is taken by VoidResult
50: }
51:
52: // @Override
53: public String toString() {
54: return "{NullPayload}";
55: }
56:
57: }
|