org.vfdtech.enums.RedisEnvironment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utilities-and-generic-tools Show documentation
Show all versions of utilities-and-generic-tools Show documentation
A utilities service with generic tools implementation. Can be
plugged into your java project
package org.vfdtech.enums;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Getter
public enum RedisEnvironment {
DEVELOPMENT(3), PRODUCTION(4), STAGING(5);
final int dbIndex;
RedisEnvironment(final int dbIndex) {
this.dbIndex = dbIndex;
}
public static Optional getInstance(final String va) {
final List correspondingRedisEnv =
Arrays.stream(values()).filter(redisEnvironment ->
redisEnvironment.name().equalsIgnoreCase(va)).collect(Collectors.toList());
return correspondingRedisEnv.stream().findFirst();
}
}