generic tag panel: binary editor now can edit byte[]

This commit is contained in:
honfika@gmail.com
2015-08-03 08:32:54 +02:00
parent 47152b3a13
commit 586111ea8a
5 changed files with 1301 additions and 1260 deletions

View File

@@ -41,6 +41,10 @@ public class ReflectionTools {
}
public static Object getValue(Object obj, Field field, int index) throws IllegalArgumentException, IllegalAccessException {
if (index == -1) {
return getValue(obj, field);
}
if (getFieldSubSize(obj, field) <= index) {
return null;
}
@@ -87,6 +91,11 @@ public class ReflectionTools {
@SuppressWarnings("unchecked")
public static void setValue(Object obj, Field field, int index, Object newValue) throws IllegalArgumentException, IllegalAccessException {
if (index == -1) {
setValue(obj, field, newValue);
return;
}
Object value = field.get(obj);
if (needsIndex(field) && index >= getFieldSubSize(obj, field)) { //outofbounds, ignore
return;