2
|
1 |
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
|
2 |
// Use of this source code is governed by a BSD-style license that can be
|
|
3 |
// found in the LICENSE file.
|
|
4 |
|
|
5 |
package org.chromium.sdk.internal;
|
|
6 |
|
|
7 |
import java.util.HashMap;
|
|
8 |
import java.util.Map;
|
|
9 |
|
|
10 |
/**
|
|
11 |
* Known V8 VM property types. The default is NORMAL.
|
|
12 |
*/
|
|
13 |
public enum PropertyType {
|
|
14 |
NORMAL(0),
|
|
15 |
FIELD(1),
|
|
16 |
CONSTANT_FUNCTION(2),
|
|
17 |
CALLBACKS(3),
|
|
18 |
INTERCEPTOR(4),
|
|
19 |
MAP_TRANSITION(5),
|
|
20 |
CONSTANT_TRANSITION(6),
|
|
21 |
NULL_DESCRIPTOR(7),
|
|
22 |
;
|
|
23 |
|
|
24 |
public final int value;
|
|
25 |
|
|
26 |
private PropertyType(int value) {
|
|
27 |
this.value = value;
|
|
28 |
}
|
|
29 |
|
|
30 |
private static Map<Integer, PropertyType> valueToTypeMap = new HashMap<Integer, PropertyType>();
|
|
31 |
|
|
32 |
static {
|
|
33 |
for (PropertyType type : values()) {
|
|
34 |
valueToTypeMap.put(type.value, type);
|
|
35 |
}
|
|
36 |
}
|
|
37 |
|
|
38 |
public static PropertyType forValue(Integer value) {
|
|
39 |
if (value == null) {
|
|
40 |
return null;
|
|
41 |
}
|
|
42 |
return valueToTypeMap.get(value);
|
|
43 |
}
|
|
44 |
|
|
45 |
}
|