01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package org.codehaus.aspectwerkz.reflect.impl.java;
08:
09: import org.codehaus.aspectwerkz.reflect.ClassInfo;
10: import org.codehaus.aspectwerkz.reflect.MemberInfo;
11:
12: import java.lang.reflect.Member;
13: import java.util.List;
14:
15: /**
16: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
17: */
18: public abstract class JavaMemberInfo implements MemberInfo {
19: /**
20: * The member.
21: */
22: protected final Member m_member;
23:
24: /**
25: * The declaring type.
26: */
27: protected final ClassInfo m_declaringType;
28:
29: /**
30: * The attributes.
31: */
32: protected List m_annotations = null;
33:
34: /**
35: * The class info repository.
36: */
37: protected final JavaClassInfoRepository m_classInfoRepository;
38:
39: /**
40: * Creates a new member meta data instance.
41: *
42: * @param member
43: * @param declaringType
44: */
45: JavaMemberInfo(final Member member,
46: final JavaClassInfo declaringType) {
47: if (member == null) {
48: throw new IllegalArgumentException("member can not be null");
49: }
50: if (declaringType == null) {
51: throw new IllegalArgumentException(
52: "declaring type can not be null");
53: }
54: m_member = member;
55: m_declaringType = declaringType;
56: m_classInfoRepository = JavaClassInfoRepository
57: .getRepository(member.getDeclaringClass()
58: .getClassLoader());
59: }
60:
61: /**
62: * Returns the name.
63: *
64: * @return the name
65: */
66: public String getName() {
67: return m_member.getName();
68: }
69:
70: /**
71: * Returns the modifiers.
72: *
73: * @return the modifiers
74: */
75: public int getModifiers() {
76: return m_member.getModifiers();
77: }
78:
79: /**
80: * Returns the declaring type.
81: *
82: * @return the declaring type
83: */
84: public ClassInfo getDeclaringType() {
85: return m_declaringType;
86: }
87: }
|