[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/collection ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 14:48:50 EST 2006
User: msurtani
Date: 06/12/30 14:48:50
Modified: src-50/org/jboss/cache/pojo/collection
CollectionInterceptorUtil.java
Log:
Genericised, autoboxed
Revision Changes Path
1.9 +27 -19 JBossCache/src-50/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CollectionInterceptorUtil.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- CollectionInterceptorUtil.java 20 Nov 2006 23:32:49 -0000 1.8
+++ CollectionInterceptorUtil.java 30 Dec 2006 19:48:50 -0000 1.9
@@ -8,12 +8,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.AspectManager;
-import org.jboss.aop.pointcut.ast.ParseException;
+import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.advice.AdviceBinding;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.pointcut.ast.ParseException;
import org.jboss.aop.proxy.ClassProxy;
import org.jboss.aop.proxy.ClassProxyFactory;
import org.jboss.aop.util.MethodHashing;
@@ -55,21 +55,24 @@
// Also take care of just toString()
try
{
- String bindName = clazz.getName() +".toString";
+ String bindName = clazz.getName() + ".toString";
HashMap<String, AdviceBinding> bindings = AspectManager.instance().getBindings();
- if(bindings.get(bindName) == null)
+ if (bindings.get(bindName) == null)
{
String bind = null;
- if(interceptor instanceof CachedListInterceptor)
+ if (interceptor instanceof CachedListInterceptor)
{
bind = "execution(public String " + CachedListAbstract.class.getName() + "->toString())";
- } else if (interceptor instanceof CachedSetInterceptor)
+ }
+ else if (interceptor instanceof CachedSetInterceptor)
{
bind = "execution(public String " + CachedSetImpl.class.getName() + "->toString())";
- } else if (interceptor instanceof CachedMapInterceptor)
+ }
+ else if (interceptor instanceof CachedMapInterceptor)
{
bind = "execution(public String " + CachedMapImpl.class.getName() + "->toString())";
- } else
+ }
+ else
{
throw new IllegalStateException("CollectionInterceptorUtil.createProxy(). Non Collection interceptor"
+ interceptor);
@@ -81,10 +84,11 @@
AspectManager.instance().addBinding(bindingm);
// result._getInstanceAdvisor().addBinding(bindingm);
}
- } catch (ParseException e)
+ }
+ catch (ParseException e)
{
throw new PojoCacheException("PojoUtil._attachInterceptor(): can't parse the field binding: "
- +e);
+ + e);
}
return result;
@@ -119,7 +123,8 @@
try
{
ClassProxyFactory.newInstance(clazz);
- } catch (Exception e)
+ }
+ catch (Exception e)
{
throw new RuntimeException(e);
}
@@ -134,7 +139,8 @@
try
{
tostring = Object.class.getDeclaredMethod("toString", new Class[0]);
- } catch (NoSuchMethodException e)
+ }
+ catch (NoSuchMethodException e)
{
e.printStackTrace();
throw new RuntimeException("getManagedMathods: " + e);
@@ -147,12 +153,13 @@
for (int i = 0; i < methods.length; i++)
{
long hash = MethodHashing.methodHash(methods[i]);
- managedMethods.put(new Long(hash), methods[i]);
+ managedMethods.put(hash, methods[i]);
}
// Add toString to ManagedMethod
long hash = MethodHashing.methodHash(tostring);
- managedMethods.put(new Long(hash), tostring);
- } catch (Exception ignored)
+ managedMethods.put(hash, tostring);
+ }
+ catch (Exception ignored)
{
ignored.printStackTrace();
}
@@ -171,7 +178,7 @@
if (invocation instanceof MethodInvocation)
{
MethodInvocation methodInvocation = (MethodInvocation) invocation;
- Long methodHash = new Long(methodInvocation.getMethodHash());
+ Long methodHash = methodInvocation.getMethodHash();
Method method = (Method) managedMethods.get(methodHash);
if (log.isTraceEnabled() && method != null)
{
@@ -181,7 +188,8 @@
if (method != null)
{
return method.invoke(interceptor, args);
- } else
+ }
+ else
{
method = methodInvocation.getMethod();
if (method == null)
More information about the jboss-cvs-commits
mailing list