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.

AnnotationTargetKind.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /********************************************************************
  2. * Copyright (c) 2005 Contributors. All rights reserved.
  3. * This program and the accompanying materials are made available
  4. * under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *
  8. * Contributors:
  9. * Helen Hawkins - Initial implementation
  10. *******************************************************************/
  11. package org.aspectj.weaver;
  12. import java.io.DataInputStream;
  13. import java.io.IOException;
  14. import org.aspectj.util.TypeSafeEnum;
  15. /**
  16. * A TypeSafeEnum similar to the Java5 ElementType Enum
  17. */
  18. public class AnnotationTargetKind extends TypeSafeEnum {
  19. public AnnotationTargetKind(String name, int key) {
  20. super(name, key);
  21. }
  22. public static AnnotationTargetKind read(DataInputStream s) throws IOException {
  23. int key = s.readByte();
  24. switch (key) {
  25. case 1:
  26. return ANNOTATION_TYPE;
  27. case 2:
  28. return CONSTRUCTOR;
  29. case 3:
  30. return FIELD;
  31. case 4:
  32. return LOCAL_VARIABLE;
  33. case 5:
  34. return METHOD;
  35. case 6:
  36. return PACKAGE;
  37. case 7:
  38. return PARAMETER;
  39. case 8:
  40. return TYPE;
  41. }
  42. throw new BCException("weird annotation target kind " + key);
  43. }
  44. public static final AnnotationTargetKind ANNOTATION_TYPE = new AnnotationTargetKind("ANNOTATION_TYPE", 1);
  45. public static final AnnotationTargetKind CONSTRUCTOR = new AnnotationTargetKind("CONSTRUCTOR", 2);
  46. public static final AnnotationTargetKind FIELD = new AnnotationTargetKind("FIELD", 3);
  47. public static final AnnotationTargetKind LOCAL_VARIABLE = new AnnotationTargetKind("LOCAL_VARIABLE", 4);
  48. public static final AnnotationTargetKind METHOD = new AnnotationTargetKind("METHOD", 5);
  49. public static final AnnotationTargetKind PACKAGE = new AnnotationTargetKind("PACKAGE", 6);
  50. public static final AnnotationTargetKind PARAMETER = new AnnotationTargetKind("PARAMETER", 7);
  51. public static final AnnotationTargetKind TYPE = new AnnotationTargetKind("TYPE", 8);
  52. }