package _5_36;
import java.util.*;
import java.lang.reflect.Method;
public class UserAnnotation {
public static void main(String[] args) {
List<Integer> li = new ArrayList<Integer>();
Collections.addAll(li, 47, 48, 49, 50); // 将元素 47, 48, 49, 50 插入集合 li 中
trackUseCases(li, PasswordUtils.class);
}
public static void trackUseCases(List<Integer> li, Class<?> cl) {
for (Method m : cl.getDeclaredMethods()) {
UseCase uc = m.getAnnotation(UseCase.class);
if (uc != null) {
System.out.println("Found Use Case:" + uc.id() + " " + uc.description());
li.remove(new Integer(uc.id()));
}
}
for (int i : li) {
System.out.println("Warning: Missing use case-" + i);
}
}
}
3861

被折叠的 条评论
为什么被折叠?



