Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import java.util.Comparator;
  2. import java.util.Set;
  3. import java.util.TreeSet;
  4. import org.aspectj.lang.reflect.*;
  5. public class ReflectBilling {
  6. public static void main(String[] args) {
  7. AjType<Billing> billingType = AjTypeSystem.getAjType(Billing.class);
  8. InterTypeMethodDeclaration[] itdms = billingType.getDeclaredITDMethods();
  9. Set s = new TreeSet(new Comparator<InterTypeMethodDeclaration>() {
  10. public int compare(InterTypeMethodDeclaration m1, InterTypeMethodDeclaration m2) {
  11. if (m1 == m2) return 0;
  12. int vis = (m1.getModifiers() - m2.getModifiers());
  13. if (vis != 0) return vis;
  14. int name = (m1.getName().compareTo(m2.getName()));
  15. if (name != 0) return name;
  16. try {
  17. return (
  18. m1.getTargetType().getJavaClass().getName().compareTo(
  19. m2.getTargetType().getJavaClass().getName())
  20. );
  21. } catch (ClassNotFoundException ex) {
  22. throw new RuntimeException(ex);
  23. }
  24. }
  25. });
  26. for (InterTypeMethodDeclaration itdm : itdms) { s.add(itdm); }
  27. for (Object o : s) { System.out.println(o); }
  28. InterTypeFieldDeclaration[] itdfs = billingType.getDeclaredITDFields();
  29. Set s2 = new TreeSet(new Comparator<InterTypeFieldDeclaration>() {
  30. public int compare(InterTypeFieldDeclaration m1, InterTypeFieldDeclaration m2) {
  31. if (m1 == m2) return 0;
  32. int vis = (m1.getModifiers() - m2.getModifiers());
  33. if (vis != 0) return vis;
  34. int name = (m1.getName().compareTo(m2.getName()));
  35. if (name != 0) return name;
  36. try {
  37. return (
  38. m1.getTargetType().getJavaClass().getName().compareTo(
  39. m2.getTargetType().getJavaClass().getName())
  40. );
  41. } catch (ClassNotFoundException ex) {
  42. throw new RuntimeException(ex);
  43. }
  44. }
  45. });
  46. for (InterTypeFieldDeclaration itdf : itdfs) { s2.add(itdf); }
  47. for (Object o : s2) { System.out.println(o); } }
  48. }