Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ResolvedPointcutDefinition.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. import java.io.DataOutputStream;
  14. import java.io.IOException;
  15. import org.aspectj.weaver.patterns.Pointcut;
  16. public class ResolvedPointcutDefinition extends ResolvedMember {
  17. private Pointcut pointcut;
  18. public ResolvedPointcutDefinition(
  19. TypeX declaringType,
  20. int modifiers,
  21. String name,
  22. TypeX[] parameterTypes,
  23. Pointcut pointcut)
  24. {
  25. super(
  26. POINTCUT,
  27. declaringType,
  28. modifiers,
  29. ResolvedTypeX.VOID,
  30. name,
  31. parameterTypes);
  32. this.pointcut = pointcut;
  33. //XXXpointcut.assertState(Pointcut.RESOLVED);
  34. checkedExceptions = TypeX.NONE;
  35. }
  36. // ----
  37. public void write(DataOutputStream s) throws IOException {
  38. getDeclaringType().write(s);
  39. s.writeInt(getModifiers());
  40. s.writeUTF(getName());
  41. TypeX.writeArray(getParameterTypes(), s);
  42. pointcut.write(s);
  43. }
  44. public static ResolvedPointcutDefinition read(VersionedDataInputStream s, ISourceContext context) throws IOException {
  45. return new ResolvedPointcutDefinition(
  46. TypeX.read(s),
  47. s.readInt(),
  48. s.readUTF(),
  49. TypeX.readArray(s),
  50. Pointcut.read(s, context));
  51. }
  52. public String toString() {
  53. StringBuffer buf = new StringBuffer();
  54. buf.append("pointcut ");
  55. buf.append(getDeclaringType().getName());
  56. buf.append(".");
  57. buf.append(getName());
  58. buf.append("(");
  59. for (int i=0; i < getParameterTypes().length; i++) {
  60. if (i > 0) buf.append(", ");
  61. buf.append(getParameterTypes()[i].toString());
  62. }
  63. buf.append(")");
  64. //buf.append(pointcut);
  65. return buf.toString();
  66. }
  67. public Pointcut getPointcut() {
  68. return pointcut;
  69. }
  70. public boolean isAjSynthetic() {
  71. return true;
  72. }
  73. // for testing
  74. public static final ResolvedPointcutDefinition DUMMY =
  75. new ResolvedPointcutDefinition(TypeX.OBJECT, 0, "missing",
  76. TypeX.NONE, Pointcut.makeMatchesNothing(Pointcut.RESOLVED));
  77. public void setPointcut(Pointcut pointcut) {
  78. this.pointcut = pointcut;
  79. }
  80. }