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.

InterTypeDeclarationImpl.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* *******************************************************************
  2. * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Adrian Colyer Initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.internal.lang.reflect;
  13. import org.aspectj.lang.reflect.AjType;
  14. import org.aspectj.lang.reflect.InterTypeDeclaration;
  15. /**
  16. * @author colyer
  17. *
  18. */
  19. public class InterTypeDeclarationImpl implements InterTypeDeclaration {
  20. private AjType<?> declaringType;
  21. protected String targetTypeName;
  22. private AjType<?> targetType;
  23. private int modifiers;
  24. public InterTypeDeclarationImpl(AjType<?> decType, String target, int mods) {
  25. this.declaringType = decType;
  26. this.targetTypeName = target;
  27. this.modifiers = mods;
  28. try {
  29. this.targetType = (AjType<?>) StringToType.stringToType(target, decType.getJavaClass());
  30. } catch (ClassNotFoundException cnf) {
  31. // we'll only report this later if the user asks for the target type.
  32. }
  33. }
  34. public InterTypeDeclarationImpl(AjType<?> decType, AjType<?> targetType, int mods) {
  35. this.declaringType = decType;
  36. this.targetType = targetType;
  37. this.targetTypeName = targetType.getName();
  38. this.modifiers = mods;
  39. }
  40. public AjType<?> getDeclaringType() {
  41. return this.declaringType;
  42. }
  43. public AjType<?> getTargetType() throws ClassNotFoundException {
  44. if (this.targetType == null) throw new ClassNotFoundException(this.targetTypeName);
  45. return this.targetType;
  46. }
  47. public int getModifiers() {
  48. return this.modifiers;
  49. }
  50. }