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ů.

HasAnnotation.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.weaver.ast;
  12. import org.aspectj.weaver.ResolvedType;
  13. import org.aspectj.weaver.UnresolvedType;
  14. public class HasAnnotation extends Test {
  15. private Var v;
  16. private ResolvedType annType;
  17. public HasAnnotation(Var v, ResolvedType annType) {
  18. super();
  19. this.v = v;
  20. this.annType = annType;
  21. }
  22. /* (non-Javadoc)
  23. * @see org.aspectj.weaver.ast.Test#accept(org.aspectj.weaver.ast.ITestVisitor)
  24. */
  25. public void accept(ITestVisitor v) {
  26. v.visit(this);
  27. }
  28. public String toString() {
  29. return "(" + v + " has annotation @" + annType + ")";
  30. }
  31. public boolean equals(Object other) {
  32. if (other instanceof HasAnnotation) {
  33. HasAnnotation o = (HasAnnotation) other;
  34. return o.v.equals(v) && o.annType.equals(annType);
  35. } else {
  36. return false;
  37. }
  38. }
  39. public int hashCode() {
  40. return v.hashCode()*37+annType.hashCode();
  41. }
  42. public Var getVar() {
  43. return v;
  44. }
  45. public UnresolvedType getAnnotationType() {
  46. return annType;
  47. }
  48. }