Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

IRelationshipMap.java 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. * <p>
  22. *
  23. * <p>
  24. * The elements can be stored and looked up as IProgramElement(s), in which cases the element corresponding to the handle is looked
  25. * up in the containment hierarchy.
  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. *
  31. * @author Mik Kersten
  32. * @author Andy Clement
  33. */
  34. public interface IRelationshipMap extends Serializable {
  35. /**
  36. * @return list of relationships or null if the source element has no relationships
  37. */
  38. public List<IRelationship> get(IProgramElement sourceProgramElement);
  39. /**
  40. * @return list of relationships or null if the source element has no relationships
  41. */
  42. public List<IRelationship> get(String sourceHandle);
  43. /**
  44. * Return a relationship matching the kind and name for the given element.
  45. *
  46. * @return null if the relationship is not found.
  47. */
  48. public IRelationship get(IProgramElement source, IRelationship.Kind kind, String relationshipName, boolean runtimeTest,
  49. boolean createIfMissing);
  50. /**
  51. * Return a relationship matching the kind and name for the given element.
  52. *
  53. * @return null if the relationship is not found.
  54. */
  55. public IRelationship get(IProgramElement source, IRelationship.Kind kind, String relationshipName);
  56. /**
  57. * Return a relationship matching the kind and name for the given element. Creates the relationship if not found.
  58. *
  59. * @return null if the relationship is not found.
  60. */
  61. public IRelationship get(String source, IRelationship.Kind kind, String relationshipName, boolean runtimeTest,
  62. boolean createIfMissing);
  63. public void put(IProgramElement source, IRelationship relationship);
  64. public void put(String handle, IRelationship relationship);
  65. public boolean remove(String handle, IRelationship relationship);
  66. public void removeAll(String source);
  67. /**
  68. * Clear all of the relationships in the map.
  69. */
  70. public void clear();
  71. public Set<String> getEntries();
  72. }