Skip to content

Instantly share code, notes, and snippets.

@MrFincher
Created May 2, 2019 15:37
Show Gist options
  • Save MrFincher/101323b3f8246c2452d0e0bc0ad75dec to your computer and use it in GitHub Desktop.
Save MrFincher/101323b3f8246c2452d0e0bc0ad75dec to your computer and use it in GitHub Desktop.
automated explode() for sebi-daos mapper using reflection
@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