blob: 9052ee8ecc3867d49fc5b11ef28087ab563bedfc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.yst.libmlr.converter.entity;
public enum Operator {
EQ("eq"),
NEQ("neq"),
GT("gt"),
GEQ("geq"),
LT("lt"),
LEQ("leq");
private final String id;
Operator(String id) {
this.id = id;
}
public static Operator parse(String str) {
for (Operator op : Operator.values()) {
if (op.id.equals(str))
return op;
}
throw new IllegalArgumentException();
}
public String getId() {
return id;
}
public static void main(String[] args) {
Operator op = Operator.parse("gt");
System.out.println("operator.toString = " + op.toString());
System.out.println("operator = " + op.getId());
}
}
|