1 4 package com.tc.aspectwerkz.reflect; 5 6 12 public class CflowMetaData { 13 16 private final String m_className; 17 18 21 private ClassInfo m_classMetaData; 22 23 26 private final MethodInfo m_methodMetaData; 27 28 34 public CflowMetaData(final ClassInfo classMetaData, final MethodInfo methodMetaData) { 35 m_className = classMetaData.getName(); 36 m_classMetaData = classMetaData; 37 m_methodMetaData = methodMetaData; 38 } 39 40 45 public ClassInfo getClassInfo() { 46 return m_classMetaData; 47 } 48 49 54 public String getClassName() { 55 return m_className; 56 } 57 58 63 public MethodInfo getMethodInfo() { 64 return m_methodMetaData; 65 } 66 67 public String toString() { 69 return '[' + super.toString() + ": " + ',' + m_className + ',' + m_classMetaData + ',' + m_methodMetaData + 70 ']'; 71 } 72 73 public int hashCode() { 74 int result = 17; 75 result = (37 * result) + hashCodeOrZeroIfNull(m_className); 76 result = (37 * result) + hashCodeOrZeroIfNull(m_classMetaData); 77 result = (37 * result) + hashCodeOrZeroIfNull(m_methodMetaData); 78 return result; 79 } 80 81 protected static int hashCodeOrZeroIfNull(final Object o) { 82 if (null == o) { 83 return 19; 84 } 85 return o.hashCode(); 86 } 87 88 public boolean equals(final Object o) { 89 if (this == o) { 90 return true; 91 } 92 if (!(o instanceof CflowMetaData)) { 93 return false; 94 } 95 final CflowMetaData obj = (CflowMetaData) o; 96 return areEqualsOrBothNull(obj.m_className, this.m_className) 97 && areEqualsOrBothNull(obj.m_classMetaData, this.m_classMetaData) 98 && areEqualsOrBothNull(obj.m_methodMetaData, this.m_methodMetaData); 99 } 100 101 protected static boolean areEqualsOrBothNull(final Object o1, final Object o2) { 102 if (null == o1) { 103 return (null == o2); 104 } 105 return o1.equals(o2); 106 } 107 } | Popular Tags |