Package io.micronaut.core.annotation
Annotation Type AccessorsStyle
-
@Documented @Retention(RUNTIME) @Target({TYPE,ANNOTATION_TYPE,FIELD}) @Inherited public @interface AccessorsStyle
Annotate a class (typically a Java Bean) to make it explicit the style of its accessors when not using the standard getter and setters:@AccessorsStyle(readPrefixes = {""}, writePrefixes = {""}) public class Person { private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } public String name() { return this.name; } public void name(String name) { this.name = name; } public int age() { return this.age; } public void age(int age) { this.age = age; } }
Defining the
readPrefixes
andwritePrefixes
as empty strings makes Micronaut aware of those accessors. It is also possible to annotate fields with this annotation but the usage is only limited when using it with @ConfigurationBuilder.- Since:
- 3.3.0
-
-
Field Summary
Fields Modifier and Type Fields Description static java.lang.String
DEFAULT_READ_PREFIX
The default read prefix.static java.lang.String
DEFAULT_WRITE_PREFIX
The default write prefix.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String[]
readPrefixes
java.lang.String[]
writePrefixes
-