]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/ComparatorType.java
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / ComparatorType.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 package org.rocksdb;
7
8 enum ComparatorType {
9 JAVA_COMPARATOR((byte)0x0),
10 JAVA_DIRECT_COMPARATOR((byte)0x1),
11 JAVA_NATIVE_COMPARATOR_WRAPPER((byte)0x2);
12
13 private final byte value;
14
15 ComparatorType(final byte value) {
16 this.value = value;
17 }
18
19 /**
20 * <p>Returns the byte value of the enumerations value.</p>
21 *
22 * @return byte representation
23 */
24 byte getValue() {
25 return value;
26 }
27
28 /**
29 * <p>Get the ComparatorType enumeration value by
30 * passing the byte identifier to this method.</p>
31 *
32 * @param byteIdentifier of ComparatorType.
33 *
34 * @return ComparatorType instance.
35 *
36 * @throws IllegalArgumentException if the comparator type for the byteIdentifier
37 * cannot be found
38 */
39 static ComparatorType getComparatorType(final byte byteIdentifier) {
40 for (final ComparatorType comparatorType : ComparatorType.values()) {
41 if (comparatorType.getValue() == byteIdentifier) {
42 return comparatorType;
43 }
44 }
45
46 throw new IllegalArgumentException(
47 "Illegal value provided for ComparatorType.");
48 }
49 }