summaryrefslogtreecommitdiffstats
path: root/dcaedt_be/src/main/java/org/onap/sdc/dcae/rule/editor/enums/OperatorTypeEnum.java
blob: 2cd03a7c419941570ab2509e6bf5172eceeccae1 (plain)
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
package org.onap.sdc.dcae.rule.editor.enums;

import java.util.Arrays;

public enum OperatorTypeEnum {
	EQUALS("Equals", "OneOf"),
	NOT_EQUAL("NotEqual", "NotOneOf"),
	CONTAINS("Contains", null),
	ENDS_WITH("EndsWith", null),
	STARTS_WITH("StartsWith", null);

	private String type;
	private String modifiedType;

	OperatorTypeEnum(String type, String modifiedType) {
		this.type = type;
		this.modifiedType = modifiedType;
	}

	public String getType() {
		return type;
	}

	public String getModifiedType() {
		return modifiedType;
	}

	public static OperatorTypeEnum getTypeByName(String name) {
		return Arrays.stream(OperatorTypeEnum.values()).filter(type -> name.replaceAll(" ", "").equalsIgnoreCase(type.getType())).findAny().orElse(null);
	}

}