View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.config.i18n;
8   
9   import java.io.Serializable;
10  
11  public class Message implements Serializable
12  {
13      /**
14       * Serial version
15       */
16      private static final long serialVersionUID = -6109760447384477924L;
17  
18      private String message;
19      private int code = 0;
20      private Object[] args;
21      private Message nextMessage;
22  
23      protected Message(String message, int code, Object... args)
24      {
25          super();
26          this.message = message;
27          this.code = code;
28          this.args = args;
29      }
30  
31      public int getCode()
32      {
33          return code;
34      }
35  
36      public Object[] getArgs()
37      {
38          return args;
39      }
40  
41      public String getMessage()
42      {
43          return message + (nextMessage != null ? ". " + nextMessage.getMessage() : "");
44      }
45  
46      public Message setNextMessage(Message nextMessage)
47      {
48          this.nextMessage = nextMessage;
49          return this;
50      }
51  
52      public Message getNextMessage()
53      {
54          return nextMessage;
55      }
56  
57      public String toString()
58      {
59          return this.getMessage();
60      }
61  }