I am using DynamDBMapper annotations on a data cla...
# announcements
k
I am using DynamDBMapper annotations on a data class (AWS Java SDK). I am trying to get back the methods that have a particular annotation, and I am getting nothing, even though annotations on the class itself are shown. Is there something that I am missing when retrieving method annotations? (see thread for details)
The annotation looks like this:
Copy code
@DynamoDBTyped(DynamoDBMapperFieldModel.DynamoDBAttributeType.S)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
public @interface DynamoDBTypeConvertedEnum {}
My data class (simplified version) loks like this:
Copy code
@DynamoDBTable(tableName = "REPLACED_BY_VALUE_IN_ENV")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
data class Qqq(
  @DynamoDBTypeConvertedEnum
  var market: CountryCode
)
I am trying to get annotations like this: build.gradle.kts
Copy code
implementation(kotlin("reflect"))
code
Copy code
println(Qqq::class.annotations)
println(Qqq::market.annotations)
output
Copy code
[@com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable(tableName=REPLACED_BY_VALUE_IN_ENV), @com.fasterxml.jackson.annotation.JsonInclude(valueFilter=class java.lang.Void, value=NON_EMPTY, contentFilter=class java.lang.Void, content=ALWAYS)]
[]
I thought it maybe related to Java vs Kotlin, but
Qqq::getMarket.annotations
gives me an error (and I don't see an annotation there in the decompiled bytecode). The decompiled Java looks like this:
Copy code
@DynamoDBTypeConvertedEnum
@NotNull
private CountryCode market;
Will appreciate if someone will point me in the right direction
k
Thank you, @Shawn A, that has helped!