public Constructor<?> getConstructor() { return wrapped.getConstructor(); }
public Object invokeNew(Object[] args, int idx) throws Throwable { Interceptor[] cInterceptors = constructorInfos[idx].getInterceptors(); if (cInterceptors == null) cInterceptors = new Interceptor[0]; ConstructorInvocation invocation = new ConstructorInvocation(cInterceptors); invocation.setAdvisor(this); invocation.setArguments(args); invocation.setConstructor(constructors[idx]); return invocation.invokeNext(); }
public void addResponseAttachment(Object key, Object val) { wrapped.addResponseAttachment(key, val); }
/** * Copies complete state of Invocation object. * * @return a copy of this instance */ public Invocation copy() { ConstructorInvocation wrapper = new ConstructorInvocation(interceptors); wrapper.arguments = this.arguments; wrapper.constructor = this.constructor; wrapper.setAdvisor(this.getAdvisor()); wrapper.currentInterceptor = this.currentInterceptor; wrapper.metadata = this.metadata; return wrapper; }
Constructor<?> con = getConstructor(); Object[] args = getArguments(); setTargetObject(con.newInstance(args)); return getTargetObject();
Object[] arguments = cInvocation.getArguments(); Constructor<?> constructor = cInvocation.getConstructor(); return invokeNewWithoutAdvisement(arguments, constructor);
return p.matchesExecution(mi.getAdvisor(), mi.getConstructor());
public Object invokeNext() throws Throwable { if (interceptors != null && currentInterceptor < interceptors.length) { try { return interceptors[currentInterceptor++].invoke(this); } finally { // so that interceptors like clustering can reinvoke down the chain currentInterceptor--; } } try { return wrapped.invokeNext(); } finally { responseContextInfo = wrapped.getResponseContextInfo(); } }
public Advisor getAdvisor() { return wrapped.getAdvisor(); }
public Object getMetaData(Object group, Object attr) { return wrapped.getMetaData(group, attr); }
public Object[] getArguments() { return wrapped.getArguments(); }
public MetaDataResolver getInstanceResolver() { return wrapped.getInstanceResolver(); }
public Map<Object, Object> getResponseContextInfo() { return wrapped.getResponseContextInfo(); }
public Object getResponseAttachment(Object key) { return wrapped.getResponseAttachment(key); }
public Invocation copy() { ConstructorInvocationWrapper invocation = new ConstructorInvocationWrapper((ConstructorInvocation)wrapped.copy(), interceptors); invocation.currentInterceptor = this.currentInterceptor; return invocation; }
public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation) { T val = super.resolveTypedAnnotation(annotation); if (val != null) return val; if (getAdvisor() != null) { val = getAdvisor().resolveTypedAnnotation(constructor, annotation); if (val != null) return val; } return null; }
public SimpleMetaData getMetaData() { return wrapped.getMetaData(); }
public synchronized SimpleMetaData getAllMetaData(Invocation invocation) { Constructor<?> constructor = ((ConstructorInvocation)invocation).getConstructor(); return constructorMetaData.get(constructor); }
/** * This method resolves metadata based on the context of the invocation. * It iterates through its list of MetaDataResolvers to find out the * value of the metadata desired. * * This list usually is ThreadMetaData, InstanceAdvisor.getMetaData * ClassAdvisor.getMethodMetaData (or field, or constructor) * ClassAdvisor.getDefaultMetaData */ public Object getMetaData(Object group, Object attr) { Object val = super.getMetaData(group, attr); if (val != null) return val; if (getAdvisor() != null) { val = getAdvisor().getConstructorMetaData().resolve(this, group, attr); if (val != null) return val; } if (getAdvisor() != null) { val = getAdvisor().getDefaultMetaData().resolve(this, group, attr); if (val != null) return val; } return null; }
/** * @see #calculateName() */ public String calculateName() { if (invocation instanceof ConstructorInvocation) { Constructor constructor = ((ConstructorInvocation) invocation).getConstructor(); return calculateShortName(constructor.getDeclaringClass()) + "::" + constructor.getName(); } else if (invocation instanceof MethodInvocation) { Method method = ((MethodInvocation) invocation).getMethod(); return calculateName(method.getDeclaringClass(), method.getName()); } else { return "Unsupported JBossAOP invocation type: " + invocation.getClass(); } }