1 4 package com.tc.aspectwerkz.transform.inlining.compiler; 5 6 import com.tc.aspectwerkz.joinpoint.management.AdviceInfoContainer; 7 import com.tc.aspectwerkz.transform.TransformationConstants; 8 import com.tc.aspectwerkz.transform.inlining.EmittedJoinPoint; 9 import com.tc.aspectwerkz.util.Strings; 10 import com.tc.aspectwerkz.reflect.ClassInfo; 11 12 17 public final class CompilationInfo { 18 private final Model m_initialModel; 19 private Model m_redefinedModel; 20 private int m_redefinitionCounter = 0; 21 22 public CompilationInfo(final Model initialModel) { 23 m_initialModel = initialModel; 24 } 25 26 public Model getInitialModel() { 27 return m_initialModel; 28 } 29 30 public Model getRedefinedModel() { 31 return m_redefinedModel; 32 } 33 34 public void setRedefinedModel(final Model redefinedModel) { 35 m_redefinedModel = redefinedModel; 36 } 37 38 public int getRedefinitionCounter() { 39 return m_redefinitionCounter; 40 } 41 42 public void incrementRedefinitionCounter() { 43 m_redefinitionCounter += 1; 44 } 45 46 public boolean equals(Object o) { 47 if (this == o) { 48 return true; 49 } 50 if (!(o instanceof CompilationInfo)) { 51 return false; 52 } 53 54 final CompilationInfo compilationInfo = (CompilationInfo) o; 55 56 if (m_redefinitionCounter != compilationInfo.m_redefinitionCounter) { 57 return false; 58 } 59 if (m_initialModel != null ? 60 !m_initialModel.equals(compilationInfo.m_initialModel) : 61 compilationInfo.m_initialModel != null) { 62 return false; 63 } 64 if (m_redefinedModel != null ? 65 !m_redefinedModel.equals(compilationInfo.m_redefinedModel) : 66 compilationInfo.m_redefinedModel != null) { 67 return false; 68 } 69 70 return true; 71 } 72 73 public int hashCode() { 74 int result; 75 result = (m_initialModel != null ? m_initialModel.hashCode() : 0); 76 result = 29 * result + (m_redefinedModel != null ? m_redefinedModel.hashCode() : 0); 77 result = 29 * result + m_redefinitionCounter; 78 return result; 79 } 80 81 86 public final static class Model { 87 private final String m_joinPointClassName; 88 private final EmittedJoinPoint m_emittedJoinPoint; 89 private final AdviceInfoContainer m_adviceInfoContainer; 90 private final ClassInfo m_thisClassInfo; 91 92 public Model(final EmittedJoinPoint emittedJoinPoint, 93 final AdviceInfoContainer adviceInfoContainer, 94 final ClassInfo thisClassInfo) { 95 m_emittedJoinPoint = emittedJoinPoint; 96 m_adviceInfoContainer = adviceInfoContainer; 97 m_joinPointClassName = m_emittedJoinPoint.getJoinPointClassName(); 98 m_thisClassInfo = thisClassInfo; 99 } 100 101 public Model(final EmittedJoinPoint emittedJoinPoint, 102 final AdviceInfoContainer adviceInfoContainer, 103 final int redefinitionCounter, 104 final ClassInfo thisClassInfo) { 105 m_emittedJoinPoint = emittedJoinPoint; 106 m_adviceInfoContainer = adviceInfoContainer; 107 m_joinPointClassName = Strings.replaceSubString( 108 m_emittedJoinPoint.getJoinPointClassName(), 109 TransformationConstants.JOIN_POINT_CLASS_SUFFIX, 110 new StringBuffer ().append('_').append(redefinitionCounter). 111 append(TransformationConstants.JOIN_POINT_CLASS_SUFFIX).toString() 112 ); 113 m_thisClassInfo = thisClassInfo; 114 } 115 116 public String getJoinPointClassName() { 117 return m_joinPointClassName; 118 } 119 120 public EmittedJoinPoint getEmittedJoinPoint() { 121 return m_emittedJoinPoint; 122 } 123 124 public AdviceInfoContainer getAdviceInfoContainer() { 125 return m_adviceInfoContainer; 126 } 127 128 133 public ClassInfo getThisClassInfo() { 134 return m_thisClassInfo; 135 } 136 137 public int hashCode() { 138 return m_emittedJoinPoint.hashCode(); 139 } 140 141 public boolean equals(Object o) { 142 return ((Model) o).m_emittedJoinPoint == m_emittedJoinPoint; 143 } 144 } 145 } | Popular Tags |