View Javadoc
1   package org.imageconverter.domain.conversion;
2   
3   import static org.apache.commons.lang3.StringUtils.upperCase;
4   
5   import io.swagger.v3.oas.annotations.media.Schema;
6   
7   /**
8    * Conversion execution's type.
9    * 
10   * @author Fernando Romulo da Silva
11   */
12  @Schema(enumAsRef = true)
13  public enum ExecutionType {
14  
15      UNKNOWN,
16      
17      BATCH,
18  
19      WS,
20  
21      MS,
22      
23      WEB,
24      
25      DESKTOP;
26      
27      /**
28       * Convert string to objects
29       * 
30       * @param string The string to 
31       * @return A object {@link ExecutionType} enum
32       */
33      public static ExecutionType from(final String string) {
34  	   
35  	final var stringTypeNew = upperCase(string);
36  	
37  	return switch (stringTypeNew) { //
38  	        case "BATCH" -> BATCH; 
39  	        case "WS" -> WS; // Web Service
40  	        case "MS" -> MS; // Messaging Service
41  	        case "WEB" -> WEB; // Spring MVC
42  	        case "DESKTOP" -> DESKTOP; // 
43  	        default -> UNKNOWN;
44  	};
45      }
46  }