Skip to content

Commit

Permalink
Simplifying the code in ReplicationType
Browse files Browse the repository at this point in the history
I forgot that valueOf parses the name of the enum and not its value.

Signed-off-by: Kartik Ganesh <[email protected]>
  • Loading branch information
kartg committed Apr 22, 2022
1 parent 8bda19d commit 25901f4
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@

package org.opensearch.indices.replication.common;

/**
* Enumerates the types of replication strategies supported by OpenSearch.
* For more information, see https://github.com/opensearch-project/OpenSearch/issues/1694
*/
public enum ReplicationType {

DOCUMENT("document"),

SEGMENT("segment");

private final String value;

ReplicationType(String replicationType) {
this.value = replicationType;
}
DOCUMENT,
SEGMENT;

public static ReplicationType parseString(String replicationType) {
try {
Expand All @@ -30,9 +27,4 @@ public static ReplicationType parseString(String replicationType) {
return DOCUMENT;
}
}

@Override
public String toString() {
return value;
}
}

0 comments on commit 25901f4

Please sign in to comment.