Annotations on Records and Record Components
Summers Pittman ℝ
secondsun at gmail.com
Tue Jan 28 15:13:41 UTC 2020
I created a record but I can't access the annotations on the record
components.
Given the following record
```java
record Record(@JsonProperty("id") int id, @JsonProperty("text") String
text){ }
```
I ran the following code to reflect the annotations
```java
var recClass = Record.class;
for (RecordComponent recordComponent :
recClass.getRecordComponents()) {
System.out.print("RecordComponent : ");
System.out.println(recordComponent.toString());
for (Annotation anno :
recordComponent.getDeclaredAnnotations()) {
System.out.print("RecordComponent Annotation : ");
System.out.println(anno);
}
}
```
and I don't see the annotations listed in the output:
```txt
RecordComponent : int id
RecordComponent : java.lang.String text
```
Am I holding it wrong? I'm using Java 14.ea.33 if the version helps.
Summers Pittman
>>Phone:404 941 4698
>>Java is my crack.
More information about the amber-dev
mailing list