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.util.queue;
8   
9   public class QueueConfiguration
10  {
11  
12      protected int capacity;
13      protected boolean persistent;
14  
15      public QueueConfiguration(int capacity, boolean persistent)
16      {
17          this.capacity = capacity;
18          this.persistent = persistent;
19      }
20  
21      public QueueConfiguration(int capacity)
22      {
23          this(capacity, false);
24      }
25  
26      public QueueConfiguration(boolean persistent)
27      {
28          this(0, persistent);
29      }
30  
31      public QueueConfiguration()
32      {
33          this(0, false);
34      }
35  
36      /**
37       * @return Returns the capacity.
38       */
39      public int getCapacity()
40      {
41          return capacity;
42      }
43  
44      /**
45       * @param capacity The capacity to set.
46       */
47      public void setCapacity(int capacity)
48      {
49          this.capacity = capacity;
50      }
51  
52      /**
53       * @return Returns the persistent.
54       */
55      public boolean isPersistent()
56      {
57          return persistent;
58      }
59  
60      /**
61       * @param persistent The persistent to set.
62       */
63      public void setPersistent(boolean persistent)
64      {
65          this.persistent = persistent;
66      }
67  
68      @Override
69      public int hashCode()
70      {
71          final int prime = 31;
72          int result = 1;
73          result = prime * result + capacity;
74          result = prime * result + (persistent ? 1231 : 1237);
75          return result;
76      }
77  
78      @Override
79      public boolean equals(Object obj)
80      {
81          if (this == obj)
82          {
83              return true;
84          }
85          if (obj == null)
86          {
87              return false;
88          }
89          if (getClass() != obj.getClass())
90          {
91              return false;
92          }
93          QueueConfiguration other = (QueueConfiguration) obj;
94          if (capacity != other.capacity)
95          {
96              return false;
97          }
98          if (persistent != other.persistent)
99          {
100             return false;
101         }
102         return true;
103     }
104     
105 }