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;
8   
9   public enum MessageExchangePattern
10  {    
11      ONE_WAY
12      {
13          @Override
14          public boolean hasResponse()
15          {
16              return false;
17          }
18      }, 
19      
20      REQUEST_RESPONSE
21      {
22          @Override
23          public boolean hasResponse()
24          {
25              return true;
26          }
27      }; 
28      
29      public abstract boolean hasResponse();
30  
31      public static MessageExchangePattern fromSyncFlag(boolean sync)
32      {
33          if (sync)
34          {
35              return REQUEST_RESPONSE;
36          }
37          else
38          {
39              return ONE_WAY;
40          }
41      }
42  
43      public static MessageExchangePattern fromString(String string)
44      {
45          String mepString = string.toUpperCase().replace('-', '_');
46          return MessageExchangePattern.valueOf(mepString);
47      }
48  }