Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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