Created
August 31, 2015 15:53
-
-
Save anuvrat/b3684df9ea46cf1a4e2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Getter | |
@RequiredArgsConstructor | |
public enum Attribute { | |
NAME("name"), | |
COUNTRY("country"), | |
LOCALE("locale"), | |
EMAIL_ADDRESS("email"); | |
private final String key; | |
public static Optional<Attribute> from(final String key) { | |
return Arrays.stream(Attribute.values()) | |
.filter(a -> a.getKey().equalsIgnoreCase(key)) | |
.findAny(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment