} else if (data.getBooleanCount() > 0) {
return new PersistedBoolean(data.getBoolean(index));
} else if (data.getLongCount() > 0) {
return new PersistedLong(data.getLong(index));
} else if (data.getStringCount() > 0) {
return new PersistedString(data.getString(index));
} else if (data.hasBytes()) {
throw new IllegalStateException("Data is not an array");
}
throw new IndexOutOfBoundsException(index + " exceeds size of array data");
}