You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Member.java 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * 2005 Contributors
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/epl-v10.html
  9. *
  10. * Contributors:
  11. * PARC initial implementation
  12. * AMC extracted as interface
  13. * ******************************************************************/
  14. package org.aspectj.weaver;
  15. import java.io.DataInputStream;
  16. import java.io.IOException;
  17. import java.util.Collection;
  18. import java.util.Iterator;
  19. import org.aspectj.util.TypeSafeEnum;
  20. public interface Member {
  21. public static class Kind extends TypeSafeEnum {
  22. public Kind(String name, int key) { super(name, key); }
  23. public static Kind read(DataInputStream s) throws IOException {
  24. int key = s.readByte();
  25. switch(key) {
  26. case 1: return METHOD;
  27. case 2: return FIELD;
  28. case 3: return CONSTRUCTOR;
  29. case 4: return STATIC_INITIALIZATION;
  30. case 5: return POINTCUT;
  31. case 6: return ADVICE;
  32. case 7: return HANDLER;
  33. case 8: return MONITORENTER;
  34. case 9: return MONITOREXIT;
  35. }
  36. throw new BCException("weird kind " + key);
  37. }
  38. }
  39. public static final Member[] NONE = new Member[0];
  40. public static final Kind METHOD = new Kind("METHOD", 1);
  41. public static final Kind FIELD = new Kind("FIELD", 2);
  42. public static final Kind CONSTRUCTOR = new Kind("CONSTRUCTOR", 3);
  43. public static final Kind STATIC_INITIALIZATION = new Kind("STATIC_INITIALIZATION", 4);
  44. public static final Kind POINTCUT = new Kind("POINTCUT", 5);
  45. public static final Kind ADVICE = new Kind("ADVICE", 6);
  46. public static final Kind HANDLER = new Kind("HANDLER", 7);
  47. public static final Kind MONITORENTER = new Kind("MONITORENTER", 8);
  48. public static final Kind MONITOREXIT = new Kind("MONITOREXIT", 9);
  49. public ResolvedMember resolve(World world);
  50. public int compareTo(Object other);
  51. public String toLongString();
  52. public Kind getKind();
  53. public UnresolvedType getDeclaringType();
  54. public UnresolvedType getReturnType();
  55. public UnresolvedType getGenericReturnType();
  56. public UnresolvedType[] getGenericParameterTypes();
  57. public UnresolvedType getType();
  58. public String getName();
  59. public UnresolvedType[] getParameterTypes();
  60. /**
  61. * Return full signature, including return type, e.g. "()LFastCar;" for a signature without the return type,
  62. * use getParameterSignature() - it is importnant to choose the right one in the face of covariance.
  63. */
  64. public String getSignature();
  65. /**
  66. * All the signatures that a join point with this member as its signature has.
  67. */
  68. public Iterator getJoinPointSignatures(World world);
  69. public int getArity();
  70. /**
  71. * Return signature without return type, e.g. "()" for a signature *with* the return type,
  72. * use getSignature() - it is important to choose the right one in the face of covariance.
  73. */
  74. public String getParameterSignature();
  75. public boolean isCompatibleWith(Member am);
  76. public int getModifiers(World world);
  77. public int getModifiers();
  78. public UnresolvedType[] getExceptions(World world);
  79. public boolean isProtected(World world);
  80. public boolean isStatic(World world);
  81. public boolean isStrict(World world);
  82. public boolean isStatic();
  83. public boolean isInterface();
  84. public boolean isPrivate();
  85. /**
  86. * Returns true iff the member is generic (NOT parameterized)
  87. * For example, a method declared in a generic type
  88. */
  89. public boolean canBeParameterized();
  90. public int getCallsiteModifiers();
  91. public String getExtractableName();
  92. /**
  93. * If you want a sensible answer, resolve the member and call
  94. * hasAnnotation() on the ResolvedMember.
  95. */
  96. public boolean hasAnnotation(UnresolvedType ofType);
  97. /* (non-Javadoc)
  98. * @see org.aspectj.weaver.AnnotatedElement#getAnnotationTypes()
  99. */
  100. public ResolvedType[] getAnnotationTypes();
  101. public AnnotationX[] getAnnotations();
  102. public Collection/*ResolvedType*/getDeclaringTypes(World world);
  103. // ---- reflective thisJoinPoint stuff
  104. public String getSignatureMakerName();
  105. public String getSignatureType();
  106. public String getSignatureString(World world);
  107. public String[] getParameterNames(World world);
  108. }