Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //used for reflection only
- @SuppressWarnings("unused")
- private static final List<MyObject> EMPTY_MY_OBJECT = null;
- private static final Type MY_OBJECT_TYPE;
- static {
- try {
- MY_OBJECT_TYPE = MyClass.class.getDeclaredField("EMPTY_MY_OBJECT").getGenericType();
- } catch (Exception e) {
- ...
- }
- }
- private List<MyObject> readFromDisk() {
- try {
- String string = FileUtils.readFileToString(new File(JSON_FILE_NAME), null);
- return new Gson().fromJson(string, MY_OBJECT_TYPE);
- } catch (Exception e) {
- ...
- }
- }
- private static final Type MY_OBJECT_TYPE = TypeUtils.generate(List.class, MyObject.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement