Package io.micronaut.core.annotation
Annotation Interface 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
and writePrefixes
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
- Author:
- Iván López
-
Field Details
-
DEFAULT_READ_PREFIX
The default read prefix.- See Also:
-
DEFAULT_WRITE_PREFIX
The default write prefix.- See Also:
-
-
Element Details