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.

IntroductionDocImpl.java 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This file is part of the debugger and core tools for the AspectJ(tm)
  4. * programming language; see http://aspectj.org
  5. *
  6. * The contents of this file are subject to the Mozilla Public License
  7. * Version 1.1 (the "License"); you may not use this file except in
  8. * compliance with the License. You may obtain a copy of the License at
  9. * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. *
  16. * The Original Code is AspectJ.
  17. *
  18. * The Initial Developer of the Original Code is Xerox Corporation. Portions
  19. * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
  20. * All Rights Reserved.
  21. */
  22. package org.aspectj.tools.ajdoc;
  23. import org.aspectj.ajdoc.AspectDoc;
  24. import org.aspectj.ajdoc.ClassDoc;
  25. import org.aspectj.ajdoc.IntroductionDoc;
  26. import org.aspectj.compiler.crosscuts.ast.IntroducedDec;
  27. import org.aspectj.compiler.crosscuts.ast.IntroducedSuperDec;
  28. import java.util.ArrayList;
  29. import java.util.Collection;
  30. public abstract class IntroductionDocImpl
  31. extends MemberDocImpl
  32. implements IntroductionDoc {
  33. /** Creats a new instance of IntroductionDoc from <code>o</code>. */
  34. public static IntroductionDocImpl getInstance(AspectDoc ad, Object o) {
  35. return factory.getInstance(ad, o);
  36. }
  37. /** The factory in charge of creating instances of IntroductionDocImpl. */
  38. private final static Factory factory = new Factory();
  39. private final Collection targets = new ArrayList();
  40. public void addTarget(ClassDoc cd) { targets.add(cd); }
  41. protected IntroductionDocImpl(com.sun.javadoc.ClassDoc containingClass) {
  42. super(containingClass);
  43. }
  44. //protected abstract Collection createTargets();
  45. /**
  46. * Returns the classes that are affected by this introduction.
  47. *
  48. * @return an array of ClassDoc representing the classes
  49. * affected by this introduction.
  50. */
  51. public final ClassDoc[] targets() {
  52. //if (targets == null) targets = createTargets();
  53. return (ClassDoc[])targets.toArray(new ClassDoc[targets.size()]);
  54. }
  55. /**
  56. * The class is in charge of creating
  57. * instances of IntroductionDocImpl.
  58. */
  59. private final static class Factory {
  60. public static IntroductionDocImpl getInstance(AspectDoc ad, Object o) {
  61. if (o instanceof IntroducedSuperDec) {
  62. return new IntroducedSuperDocImpl(ad, (IntroducedSuperDec)o);
  63. }
  64. if (o instanceof IntroducedDec) {
  65. return new IntroducedDocImpl(ad, (IntroducedDec)o);
  66. }
  67. return null;
  68. }
  69. }
  70. /** TODO */
  71. public boolean weakEquals(Object md) {
  72. return false; // TODO
  73. }
  74. }