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.

IRelationshipMap.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* *******************************************************************
  2. * Copyright (c) 2003 Contributors.
  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. * Mik Kersten initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.asm;
  13. import java.io.Serializable;
  14. import java.util.List;
  15. import java.util.Set;
  16. /**
  17. * Maps from a program element handles to a list of relationships between that element and other program elements. Each element in
  18. * the list or relationships is uniquely identified by a kind and a relationship name. For example, the advice affecting a
  19. * particular shadow (e.g. method call) can be retrieved by calling <CODE>get</CODE> on the handle for that method. Symmetrically
  20. * the method call shadows that an advice affects can be retrieved.
  21. *
  22. * <p>
  23. * The elements can be stored and looked up as IProgramElement(s), in which cases the element corresponding to the handle is looked
  24. * up in the containment hierarchy.
  25. * </p>
  26. *
  27. * <p>
  28. * put/get methods taking IProgramElement as a parameter are for convenience only. They work identically to calling their
  29. * counterparts with IProgramElement.getIdentifierHandle()
  30. * </p>
  31. *
  32. * @author Mik Kersten
  33. * @author Andy Clement
  34. */
  35. public interface IRelationshipMap extends Serializable {
  36. /**
  37. * @return list of relationships or null if the source element has no relationships
  38. */
  39. List<IRelationship> get(IProgramElement sourceProgramElement);
  40. /**
  41. * @return list of relationships or null if the source element has no relationships
  42. */
  43. List<IRelationship> get(String sourceHandle);
  44. /**
  45. * Return a relationship matching the kind and name for the given element.
  46. *
  47. * @return null if the relationship is not found.
  48. */
  49. IRelationship get(IProgramElement source, IRelationship.Kind kind, String relationshipName, boolean runtimeTest,
  50. boolean createIfMissing);
  51. /**
  52. * Return a relationship matching the kind and name for the given element.
  53. *
  54. * @return null if the relationship is not found.
  55. */
  56. IRelationship get(IProgramElement source, IRelationship.Kind kind, String relationshipName);
  57. /**
  58. * Return a relationship matching the kind and name for the given element. Creates the relationship if not found.
  59. *
  60. * @return null if the relationship is not found.
  61. */
  62. IRelationship get(String source, IRelationship.Kind kind, String relationshipName, boolean runtimeTest,
  63. boolean createIfMissing);
  64. void put(IProgramElement source, IRelationship relationship);
  65. void put(String handle, IRelationship relationship);
  66. boolean remove(String handle, IRelationship relationship);
  67. void removeAll(String source);
  68. /**
  69. * Clear all of the relationships in the map.
  70. */
  71. void clear();
  72. Set<String> getEntries();
  73. }