The code in the constructor will never be executed and parameters do not have to be known. This is the same method used by the internals of standard Java serialization, but relies on internal code (sun.misc.Unsafe) that may not be present on all JVMs.
The implementation will use the same internals to write into fields. This is a lot faster and was additionally the only possibility to set final fields prior to Java 5.
| Modifier and Type | Field and Description |
|---|---|
| private transient Map |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private synchronized long | |
| protected void | |
| private Object | |
| private void | |
| public void | writeField(Object object, String fieldName, Object value, Class<T> definedIn)
Overrides com. Implements com. |
| fieldOffsetCache | back to summary |
|---|---|
| private transient Map<K, V> fieldOffsetCache | |
| SunUnsafeReflectionProvider | back to summary |
|---|---|
public SunUnsafeReflectionProvider()
| |
| SunUnsafeReflectionProvider | back to summary |
|---|---|
public SunUnsafeReflectionProvider(FieldDictionary dic)
| |
| getFieldOffset | back to summary |
|---|---|
| private synchronized long getFieldOffset(Field f) | |
| init | back to summary |
|---|---|
| protected void init() Overrides com. | |
| readResolve | back to summary |
|---|---|
| private Object readResolve() Hides com. | |
| write | back to summary |
|---|---|
| private void write(Field field, Object object, Object value) | |
| writeField | back to summary |
|---|---|
| public void writeField(Object object, String fieldName, Object value, Class<T> definedIn) Overrides com. Implements com. | |