TField
- Field type.public abstract class CompiledStructureModifier<TField> extends StructureModifier<TField>
Modifier and Type | Field and Description |
---|---|
protected StructureCompiler |
compiler |
converter, customConvertHandling, data, defaultFields, fieldType, subtypeCache, target, targetType
Constructor and Description |
---|
CompiledStructureModifier() |
Modifier and Type | Method and Description |
---|---|
TField |
read(int fieldIndex)
Reads the value of a field given its index.
|
protected abstract java.lang.Object |
readGenerated(int fieldIndex) |
protected java.lang.Object |
readReflected(int index)
Read the given field index using reflection.
|
StructureModifier<TField> |
withTarget(java.lang.Object target)
Retrieves a structure modifier of the same type for a different object target.
|
StructureModifier<TField> |
write(int index,
java.lang.Object value)
Writes the value of a field given its index.
|
StructureModifier<TField> |
writeDefaults()
Sets all non-primitive fields to a more fitting default value.
|
protected abstract StructureModifier<TField> |
writeGenerated(int index,
java.lang.Object value) |
protected void |
writeReflected(int index,
java.lang.Object value)
Write the given field using reflection.
|
getFields, getFieldType, getTarget, getTargetType, getValues, initialize, initialize, modify, readSafely, setConverter, size, withFieldType, withType, withType, writeSafely
protected StructureCompiler compiler
public StructureModifier<TField> writeDefaults() throws FieldAccessException
StructureModifier
DefaultInstances.getDefault(Class)
.writeDefaults
in class StructureModifier<TField>
FieldAccessException
- If we're unable to write to the fields due to a security limitation.public final TField read(int fieldIndex) throws FieldAccessException
StructureModifier
read
in class StructureModifier<TField>
fieldIndex
- - index of the field.FieldAccessException
- The field doesn't exist, or it cannot be accessed under the current security contraints.protected java.lang.Object readReflected(int index) throws FieldAccessException
index
- - index of field.FieldAccessException
- The field doesn't exist, or it cannot be accessed under the current security contraints.protected abstract java.lang.Object readGenerated(int fieldIndex) throws FieldAccessException
FieldAccessException
public StructureModifier<TField> write(int index, java.lang.Object value) throws FieldAccessException
StructureModifier
write
in class StructureModifier<TField>
index
- - index of the field.value
- - new value of the field.FieldAccessException
- The field doesn't exist, or it cannot be accessed under the current security contraints.protected void writeReflected(int index, java.lang.Object value) throws FieldAccessException
index
- - index of field.value
- - new value.FieldAccessException
- The field doesn't exist, or it cannot be accessed under the current security contraints.protected abstract StructureModifier<TField> writeGenerated(int index, java.lang.Object value) throws FieldAccessException
FieldAccessException
public StructureModifier<TField> withTarget(java.lang.Object target)
StructureModifier
withTarget
in class StructureModifier<TField>
target
- - different target of the same type.