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