Created
June 15, 2015 15:51
-
-
Save PierreBtz/b5d813066b899e783acd to your computer and use it in GitHub Desktop.
This file contains 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
private static <T extends Enum<T>, U extends Enum<U>> T fromTypeEnumToTypeEnum(U originValue, Class<T> destinationEnumClass) { | |
for(final T t : destinationEnumClass.getEnumConstants()) { | |
if(t.name().equals(originValue.name())) { | |
return t; | |
} | |
} | |
throw new UnsupportedOperationException("Translation was not implemented for " + originValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment