Package org.springframework.aop.framework

Examples of org.springframework.aop.framework.Advised


    }
  }

  private void clear(TokenStore tokenStore) throws Exception {
    if (tokenStore instanceof Advised) {
      Advised advised = (Advised) tokenStore;
      TokenStore target = (TokenStore) advised.getTargetSource().getTarget();
      clear(target);
      return;
    }
    if (tokenStore instanceof InMemoryTokenStore) {
      ((InMemoryTokenStore) tokenStore).clear();
View Full Code Here


        }

        // Determine the type that declares the requested method, taking into account proxies
        Class<?> target = AopUtils.getTargetClass(object);
        if (object instanceof Advised) {
            Advised a = (Advised) object;
            if (!a.isProxyTargetClass()) {
                Class<?>[] possibleInterfaces = a.getProxiedInterfaces();
                for (int i = 0; i < possibleInterfaces.length; i++) {
                    try {
                        possibleInterfaces[i].getMethod(methodName, classArgs);
                        // to get here means no exception happened
                        target = possibleInterfaces[i];
View Full Code Here

        Class.forName("org.springframework.aop.framework.Advised");
    }
   
    protected Class getRealClassInternal(Object o) {
        if (AopUtils.isAopProxy(o)) {
            Advised advised = (Advised)o;
            try {
                Object target = advised.getTargetSource().getTarget();
               
                if (target == null) {
                    return AopUtils.getTargetClass(o);
                } else {
                    return getRealClassInternal(target);
View Full Code Here

public class AspectUtil {

    public static Object exposeRootBean(Object managedBean) {
        try {
            if (AopUtils.isAopProxy(managedBean) && managedBean instanceof Advised) {
                Advised advised = (Advised) managedBean;
                managedBean = advised.getTargetSource().getTarget();
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return managedBean;
View Full Code Here

     *
     * @since 1.3
     */
    public static Object getTargetObject(Object proxy) throws Exception
    {
        Advised advised = (Advised) proxy;
        TargetSource targetSource = advised.getTargetSource();
        Object target = targetSource.getTarget();
       
        // Possibly we could add a method on the ScopedBeanTargetSource class to test
        // whether the target bean exists. Then here we could cast TargetSource to
        // ScopedBeanTargetSource and return null if the target does not exist. This
View Full Code Here

        Class.forName("org.springframework.aop.framework.Advised");
    }
   
    protected Class getRealClassInternal(Object o) {
        if (AopUtils.isAopProxy(o)) {
            Advised advised = (Advised)o;
            if (advised == null) {
                return AopUtils.getTargetClass(o);
            }
            try {
                return getRealClassInternal(advised.getTargetSource().getTarget());
            } catch (Exception ex) {
                // ignore
            }
           
        }
View Full Code Here

     *
     * @since 1.3
     */
    public static Object getTargetObject(Object proxy) throws Exception
    {
        Advised advised = (Advised) proxy;
        TargetSource targetSource = advised.getTargetSource();
        Object target = targetSource.getTarget();
       
        // Possibly we could add a method on the ScopedBeanTargetSource class to test
        // whether the target bean exists. Then here we could cast TargetSource to
        // ScopedBeanTargetSource and return null if the target does not exist. This
View Full Code Here

        Class.forName("org.springframework.aop.framework.Advised");
    }
   
    protected Class getRealClassInternal(Object o) {
        if (AopUtils.isAopProxy(o)) {
            Advised advised = (Advised)o;
            try {
                Object target = advised.getTargetSource().getTarget();
               
                if (target == null) {
                    return AopUtils.getTargetClass(o);
                } else {
                    return getRealClassInternal(target);
View Full Code Here

    StopWatch sw = new StopWatch();
    sw.start(howmany + " repeated before advice invocations with " + technology);
    ITestBean adrian = (ITestBean) bf.getBean("adrian");

    assertTrue(AopUtils.isAopProxy(adrian));
    Advised a = (Advised) adrian;
    assertTrue(a.getAdvisors().length >= 3);
    assertEquals("adrian", adrian.getName());

    for (int i = 0; i < howmany; i++) {
      adrian.getName();
    }
View Full Code Here

    StopWatch sw = new StopWatch();
    sw.start(howmany + " repeated after returning advice invocations with " + technology);
    ITestBean adrian = (ITestBean) bf.getBean("adrian");

    assertTrue(AopUtils.isAopProxy(adrian));
    Advised a = (Advised) adrian;
    assertTrue(a.getAdvisors().length >= 3);
    // Hits joinpoint
    adrian.setAge(25);

    for (int i = 0; i < howmany; i++) {
      adrian.setAge(i);
View Full Code Here

TOP

Related Classes of org.springframework.aop.framework.Advised

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.