Subversion Repositories SmartDukaan

Rev

Rev 1021 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 ashish 1
package in.shop2020.utils;
2
 
3
import java.util.HashMap;
4
import java.util.Map;
5
 
6
public enum ErrorCodes {
7
 
8
 
9
 
10
	ERROR_SUCCESS(0),
11
	/*
12
	 * Thrift exception ErrorCodes
13
	 */
14
	ERROR_CONNECTION_FAILURE(1),
15
	/**
16
	 * UserContextService Errors
17
	 */
18
	ERROR_PARAM_NULL(2),
19
	ERROR_ADDRESS_EXISTS(3),
20
	ERROR_USER_NOT_FOUND(4),
21
	ERROR_MULTIPLE_ENTRIES_FOUND(5)
22
 
23
	;
24
 
25
	private final int value;
26
 
27
	private ErrorCodes(int value){
28
		this.value = value;
29
	}
30
 
31
	public int getValue(){
32
		return this.value;
33
	}
34
 
2298 chandransh 35
	@SuppressWarnings("serial")
48 ashish 36
	private static final Map<Integer, ErrorCodes> BY_VALUE = new HashMap<Integer,ErrorCodes>() {{
37
		for(ErrorCodes val : ErrorCodes.values()) {
38
			put(val.getValue(), val);
39
			}
40
	}};
41
 
42
	public static ErrorCodes findByValue(int value) { 
43
		return BY_VALUE.get(value);
44
	}
45
}