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.

FormalBinding.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import org.aspectj.weaver.IHasPosition;
  14. import org.aspectj.weaver.UnresolvedType;
  15. public class FormalBinding implements IHasPosition {
  16. private final UnresolvedType type;
  17. private final String name;
  18. private final int index;
  19. private final int start, end;
  20. public FormalBinding(UnresolvedType type, String name, int index, int start, int end) {
  21. this.type = type;
  22. this.name = name;
  23. this.index = index;
  24. this.start = start;
  25. this.end = end;
  26. }
  27. public FormalBinding(UnresolvedType type, int index) {
  28. this(type, "unknown", index, 0, 0);
  29. }
  30. public FormalBinding(UnresolvedType type, String name, int index) {
  31. this(type, name, index, 0, 0);
  32. }
  33. // ----
  34. public String toString() {
  35. return type.toString() + ":" + index;
  36. }
  37. public int getEnd() {
  38. return end;
  39. }
  40. public int getStart() {
  41. return start;
  42. }
  43. public int getIndex() {
  44. return index;
  45. }
  46. public String getName() {
  47. return name;
  48. }
  49. public UnresolvedType getType() {
  50. return type;
  51. }
  52. // ----
  53. public static final FormalBinding[] NONE = new FormalBinding[0];
  54. /**
  55. * A marker class for bindings for which we want to ignore unbound issue and consider them as implicit binding - f.e. to handle
  56. * JoinPoint in @AJ advices
  57. *
  58. * @author Alexandre Vasseur (alex AT gnilux DOT com)
  59. */
  60. public static class ImplicitFormalBinding extends FormalBinding {
  61. public ImplicitFormalBinding(UnresolvedType type, String name, int index) {
  62. super(type, name, index);
  63. }
  64. }
  65. }