Created
October 8, 2014 15:51
-
-
Save jarrodhroberson/ca0a95f091d234c5dd5e 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
import com.google.common.reflect.TypeToken; | |
@SuppressWarnings("unchecked") | |
public T get() | |
{ | |
final Class<T> entityType = (Class<T>) new TypeToken<T>(getClass()) {}.getRawType(); | |
try { return entityType.newInstance(); } | |
catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment