View Javadoc
1   package org.oxerr.okcoin.rest.dto;
2   
3   import java.util.Arrays;
4   
5   /**
6    * Order type.
7    */
8   public enum Type {
9   
10  	BUY("buy"), SELL("sell"),
11  	BUY_MARKET("buy_market"), SELL_MARKET("sell_market");
12  
13  	public static Type of(String code) {
14  		return Arrays
15  			.stream(values())
16  			.filter(type -> type.code.equals(code))
17  			.findFirst()
18  			.get();
19  	}
20  
21  	private final String code;
22  
23  	Type(String code) {
24  		this.code = code;
25  	}
26  
27  	public String getCode() {
28  		return code;
29  	}
30  
31  	@Override
32  	public String toString() {
33  		return code;
34  	}
35  
36  }