1 8 package org.codehaus.aspectwerkz.reflect; 9 10 16 public class CflowMetaData { 17 20 private final String m_className; 21 22 25 private ClassInfo m_classMetaData; 26 27 30 private final MethodInfo m_methodMetaData; 31 32 38 public CflowMetaData(final ClassInfo classMetaData, final MethodInfo methodMetaData) { 39 m_className = classMetaData.getName(); 40 m_classMetaData = classMetaData; 41 m_methodMetaData = methodMetaData; 42 } 43 44 49 public ClassInfo getClassInfo() { 50 return m_classMetaData; 51 } 52 53 58 public String getClassName() { 59 return m_className; 60 } 61 62 67 public MethodInfo getMethodInfo() { 68 return m_methodMetaData; 69 } 70 71 public String toString() { 73 return '[' + super.toString() + ": " + ',' + m_className + ',' + m_classMetaData + ',' + m_methodMetaData + 74 ']'; 75 } 76 77 public int hashCode() { 78 int result = 17; 79 result = (37 * result) + hashCodeOrZeroIfNull(m_className); 80 result = (37 * result) + hashCodeOrZeroIfNull(m_classMetaData); 81 result = (37 * result) + hashCodeOrZeroIfNull(m_methodMetaData); 82 return result; 83 } 84 85 protected static int hashCodeOrZeroIfNull(final Object o) { 86 if (null == o) { 87 return 19; 88 } 89 return o.hashCode(); 90 } 91 92 public boolean equals(final Object o) { 93 if (this == o) { 94 return true; 95 } 96 if (!(o instanceof CflowMetaData)) { 97 return false; 98 } 99 final CflowMetaData obj = (CflowMetaData) o; 100 return areEqualsOrBothNull(obj.m_className, this.m_className) 101 && areEqualsOrBothNull(obj.m_classMetaData, this.m_classMetaData) 102 && areEqualsOrBothNull(obj.m_methodMetaData, this.m_methodMetaData); 103 } 104 105 protected static boolean areEqualsOrBothNull(final Object o1, final Object o2) { 106 if (null == o1) { 107 return (null == o2); 108 } 109 return o1.equals(o2); 110 } 111 } | Popular Tags |