Created
May 2, 2019 15:37
-
-
Save MrFincher/101323b3f8246c2452d0e0bc0ad75dec to your computer and use it in GitHub Desktop.
automated explode() for sebi-daos mapper using reflection
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
@Override | |
public Object[] explode( E e ) { | |
List<Field> fields = Arrays.asList(entityType.getDeclaredFields()); | |
Object[] parts = new Object[fields.size()]; | |
for (int i = 0; i < parts.length; i++) { | |
try { | |
Field field = fields.get(i); | |
field.setAccessible(true); | |
parts[i] = field.get(e); | |
} catch (IllegalAccessException e1) { | |
e1.printStackTrace(); | |
} | |
} | |
return parts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment