Java - How to get multiple annotations in a single parameter?
问题 If I have a method like this: testLink(@LinkLength(min=0, max=5) List<@LinkRange(min=5, max=9) Integer> link) { ... } How do I get both @LinkLength and @LinkRange annotation? 回答1: I'm assuming you want to reflectively access these annotations. Here's an example: package com.example; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.AnnotatedParameterizedType;