選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AnnotationAJ.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* *******************************************************************
  2. * Copyright (c) 2006-2008 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. * ******************************************************************/
  10. package org.aspectj.weaver;
  11. import java.util.Set;
  12. /**
  13. * Simple representation of an annotation that the weaver can work with.
  14. *
  15. * @author AndyClement
  16. */
  17. public interface AnnotationAJ {
  18. public static final AnnotationAJ[] EMPTY_ARRAY = new AnnotationAJ[0];
  19. /**
  20. * @return the signature for the annotation type, eg. Lcom/foo/MyAnno;
  21. */
  22. public String getTypeSignature();
  23. /**
  24. * @return the type name for the annotation, eg. com.foo.MyAnno
  25. */
  26. public String getTypeName();
  27. /**
  28. * @return the type of the annotation
  29. */
  30. public ResolvedType getType();
  31. /**
  32. * return true if this annotation can target an annotation type
  33. */
  34. public boolean allowedOnAnnotationType();
  35. /**
  36. * @return true if this annotation can be put on a field
  37. */
  38. public boolean allowedOnField();
  39. /**
  40. * @return true if this annotation can target a 'regular' type. A 'regular' type is enum/class/interface - it is *not*
  41. * annotation.
  42. */
  43. public boolean allowedOnRegularType();
  44. /**
  45. * @return for the @target annotation, this will return a set of the element-types it can be applied to. For other annotations ,
  46. * it returns the empty set.
  47. */
  48. public Set<String> getTargets();
  49. /**
  50. * @param name the name of the value
  51. * @return true if there is a value with that name
  52. */
  53. public boolean hasNamedValue(String name);
  54. /**
  55. * @param name the name of the annotation field
  56. * @param value the value of the annotation field
  57. * @return true if there is a value with the specified name and value
  58. */
  59. public boolean hasNameValuePair(String name, String value);
  60. /**
  61. * @return String representation of the valid targets for this annotation, eg. "{TYPE,FIELD}"
  62. */
  63. public String getValidTargets();
  64. /**
  65. * @return String form of the annotation and any values, eg. @Foo(a=b,c=d)
  66. */
  67. public String stringify();
  68. /**
  69. * @return true if this annotation is marked with @target
  70. */
  71. public boolean specifiesTarget();
  72. /**
  73. * @return true if the annotation is marked for runtime visibility
  74. */
  75. public boolean isRuntimeVisible();
  76. /**
  77. * Determine the string representation of the value of a field. For example in @SuppressAjWarnings({"adviceDidNotMatch"}) the
  78. * return value for getStringFormOfValue("value") would be "[adviceDidNotMatch]".
  79. *
  80. * @param name the name of the annotation field being looked up
  81. * @return string representation of the value of that field, may be null if no such field set
  82. */
  83. public String getStringFormOfValue(String name);
  84. }