1 4 package com.tc.aspectwerkz.proxy; 5 6 7 import com.tc.aspectwerkz.DeploymentModel; 8 import com.tc.aspectwerkz.definition.DefinitionParserHelper; 9 import com.tc.aspectwerkz.definition.SystemDefinition; 10 import com.tc.aspectwerkz.intercept.AdvisableImpl; 11 12 23 public class Proxy { 24 25 32 public static Object newInstance(final Class clazz, 33 final SystemDefinition definition) { 34 return ProxySubclassingStrategy.newInstance(clazz, definition); 35 } 36 37 47 public static Object newInstance(final Class clazz, 48 final Class [] argumentTypes, 49 final Object [] argumentValues, 50 final SystemDefinition definition) { 51 return ProxySubclassingStrategy.newInstance( 52 clazz, argumentTypes, argumentValues, definition); 53 } 54 55 65 public static Object newInstance(final Class clazz, 66 final boolean useCache, 67 final boolean makeAdvisable, 68 final SystemDefinition definition) { 69 return ProxySubclassingStrategy.newInstance( 70 clazz, useCache, makeAdvisable, definition); 71 } 72 73 86 public static Object newInstance(final Class clazz, 87 final Class [] argumentTypes, 88 final Object [] argumentValues, 89 final boolean useCache, 90 final boolean makeAdvisable, 91 final SystemDefinition definition) { 92 return ProxySubclassingStrategy.newInstance( 93 clazz, 94 argumentTypes, 95 argumentValues, 96 useCache, 97 makeAdvisable, 98 definition); 99 } 100 101 111 public static Object newInstance(final Class [] interfaces, 112 final Object [] implementations, 113 final boolean useCache, 114 final boolean makeAdvisable, 115 final SystemDefinition definition) { 116 return ProxyDelegationStrategy.newInstance( 117 interfaces, 118 implementations, 119 useCache, 120 makeAdvisable, 121 definition); 122 } 123 124 131 static void makeProxyAdvisable(final String proxyClassName, 132 ClassLoader loader, 133 final SystemDefinition definition) { 134 String withinPointcut = "within(" + proxyClassName.replace('/', '.') + ')'; 136 definition.addMixinDefinition(DefinitionParserHelper.createAndAddMixinDefToSystemDef(AdvisableImpl.CLASS_INFO, 137 withinPointcut, 138 DeploymentModel.PER_INSTANCE, 139 false, 140 definition)); 141 DefinitionParserHelper.createAndAddAdvisableDef('(' + withinPointcut + " && execution(!static * *.*(..)))", 142 definition); 143 } 144 } 145 | Popular Tags |