View Javadoc

1   /*
2    * $Id: NullPayload.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers;
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      /**
23       * Serial version
24       */
25      private static final long serialVersionUID = 3530905899811505080L;
26  
27      private static class NullPayloadHolder
28      {
29          private static final NullPayload instance = new NullPayload();
30      }
31  
32      public static NullPayload getInstance()
33      {
34          return NullPayloadHolder.instance;
35      }
36  
37      private NullPayload()
38      {
39          super();
40      }
41  
42      private Object readResolve() throws ObjectStreamException
43      {
44          return NullPayloadHolder.instance;
45      }
46  
47      // @Override
48      public boolean equals(Object obj)
49      {
50          return obj instanceof NullPayload;
51      }
52  
53      // @Override
54      public int hashCode ()
55      {
56          return 1; // random, 0 is taken by VoidResult
57      }
58  
59      // @Override
60      public String toString()
61      {
62          return "{NullPayload}";
63      }
64  
65  }