---
title: "InjectAccessors"
description: "Inject accessor methods for the field denoted using an Alias annotation."
kind: "annotation interface"
id: "com.oracle.svm.core.annotate.InjectAccessors"
module: "nativeimage"
version: "25.6.0-elide.4"
canonical: "https://graalvm.elide.help/25.6.0-elide.4/api/nativeimage/com/oracle/svm/core/annotate/InjectAccessors.html"
---

# @ InjectAccessors

[nativeimage](../../../../../index.md) › [com.oracle.svm.core.annotate](index.md) · Every page: [llms.txt](../../../../../llms.txt)

Annotation interface in [`com.oracle.svm.core.annotate`](index.md). Since 22.3.

```java
@Retention(RUNTIME)
@Target({FIELD})
public @interface InjectAccessors
```

Inject accessor methods for the field denoted using an [`Alias`](Alias.md) annotation. All loads and stores to the original field are redirected to accessor methods located in the class provided in the [`value`](InjectAccessors.md#value%28%29) property. The class must implement the marker interface [`InjectAccessors`](InjectAccessors.md). The accessor methods are static methods in that class, named either `get` / `set` or `getFoo` / `setFoo` for a field name `foo`. Depending on the kind of accessor (get / set for a static / non-static field), the accessor must have 0, 1, or 2 parameters. If the field is non-static, the first method parameter is the accessed object. The type of the parameter must be the class that declared the field. The null check on the object is performed before the accessor is called, in the same way as the null check for a regular field access. For get-accessors, the return type of the method must be the type of the field. For set-accessors, the last method parameter must be the type of the field and denotes the value stored to the field. If no set-accessor is provided, stores to the field lead to a fatal error during image generation. If no get-accessor is provided, loads of the field lead to a fatal error during image generation. The injected accessors must not access the original field. Since all field accesses use the accessors, that would lead to a recursive call of the accessors. Instead, data must be stored in either a new static field, or an [`injected`](Inject.md) instance field.

## Elements

### value()
<a id="value()"></a>`Class<?> value()`. Since 22.3. Cite: `com/oracle/svm/core/annotate/InjectAccessors.html#value()`
