mirror of
https://github.com/EsotericSoftware/reflectasm.git
synced 2025-01-19 16:20: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 {
|
public abstract class FieldAccess {
|
||||||
private String[] fieldNames;
|
private String[] fieldNames;
|
||||||
|
private Class[] fieldTypes;
|
||||||
private Class<?>[] fieldTypes;
|
|
||||||
|
|
||||||
public int getIndex (String fieldName) {
|
public int getIndex (String fieldName) {
|
||||||
for (int i = 0, n = fieldNames.length; i < n; i++)
|
for (int i = 0, n = fieldNames.length; i < n; i++)
|
||||||
@ -35,26 +34,14 @@ public abstract class FieldAccess {
|
|||||||
return fieldNames;
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?>[] getFieldTypes () {
|
public Class[] getFieldTypes () {
|
||||||
return fieldTypes;
|
return fieldTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getFieldType (String fieldName) {
|
|
||||||
return getFieldType(getIndex(fieldName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFieldCount () {
|
public int getFieldCount () {
|
||||||
return fieldTypes.length;
|
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 set (Object instance, int fieldIndex, Object value);
|
||||||
|
|
||||||
abstract public void setBoolean (Object instance, int fieldIndex, boolean 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()];
|
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++) {
|
for (int i = 0, n = fieldNames.length; i < n; i++) {
|
||||||
fieldNames[i] = fields.get(i).getName();
|
fieldNames[i] = fields.get(i).getName();
|
||||||
fieldTypes[i] = fields.get(i).getType();
|
fieldTypes[i] = fields.get(i).getType();
|
||||||
|
Loading…
Reference in New Issue
Block a user