mirror of
https://github.com/EsotericSoftware/reflectasm.git
synced 2025-01-19 08:10:24 +08:00
Minor refactoring.
This commit is contained in:
parent
f3ee828819
commit
cc419d9624
@ -14,8 +14,7 @@ import org.objectweb.asm.Type;
|
||||
|
||||
public abstract class FieldAccess {
|
||||
private String[] fieldNames;
|
||||
|
||||
private Class<?>[] fieldTypes;
|
||||
private Class[] fieldTypes;
|
||||
|
||||
public int getIndex (String fieldName) {
|
||||
for (int i = 0, n = fieldNames.length; i < n; i++)
|
||||
@ -35,26 +34,14 @@ public abstract class FieldAccess {
|
||||
return fieldNames;
|
||||
}
|
||||
|
||||
public Class<?>[] getFieldTypes () {
|
||||
public Class[] getFieldTypes () {
|
||||
return fieldTypes;
|
||||
}
|
||||
|
||||
public Class<?> getFieldType (String fieldName) {
|
||||
return getFieldType(getIndex(fieldName));
|
||||
}
|
||||
|
||||
public int getFieldCount () {
|
||||
return fieldTypes.length;
|
||||
}
|
||||
|
||||
public Class<?> getFieldType (int fieldIndex) {
|
||||
return fieldTypes[fieldIndex];
|
||||
}
|
||||
|
||||
public String getFieldName (int fieldIndex) {
|
||||
return fieldNames[fieldIndex];
|
||||
}
|
||||
|
||||
abstract public void set (Object instance, int fieldIndex, Object value);
|
||||
|
||||
abstract public void setBoolean (Object instance, int fieldIndex, boolean value);
|
||||
@ -109,7 +96,7 @@ public abstract class FieldAccess {
|
||||
}
|
||||
|
||||
String[] fieldNames = new String[fields.size()];
|
||||
Class<?>[] fieldTypes = new Class<?>[fields.size()];
|
||||
Class[] fieldTypes = new Class[fields.size()];
|
||||
for (int i = 0, n = fieldNames.length; i < n; i++) {
|
||||
fieldNames[i] = fields.get(i).getName();
|
||||
fieldTypes[i] = fields.get(i).getType();
|
||||
|
Loading…
Reference in New Issue
Block a user