Examples of MethodRtti


Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    public Object advice4(JoinPoint joinPoint) throws Throwable {

        final Object result = joinPoint.proceed();

        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();

        String metadata = joinPoint.getCalleeClass().getName()

                          + mrtti.getMethod().getName()

                          + joinPoint.getTarget().hashCode()

                          + mrtti.getParameterValues()[0]

                          + mrtti.getParameterTypes()[0].getName()

                          + mrtti.getReturnType().getName()

                          + mrtti.getReturnValue();

        return metadata;

    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    public Object advice4(final JoinPoint joinPoint) throws Throwable {

        final Object result = joinPoint.proceed();

        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();

        String metadata = joinPoint.getCalleeClass().getName()

                          + mrtti.getMethod().getName()

                          + mrtti.getParameterValues()[0]

                          + mrtti.getParameterTypes()[0].getName()

                          + mrtti.getReturnType().getName()

                          + mrtti.getReturnValue();

        return metadata;

    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    //---- Aspect

    public static class TestAspect {

        public void method1Advise(JoinPoint joinPoint) {
            MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
            LOG.append("call ");
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

     */
    public static class CacheAspect {
        private Map m_cache = new HashMap();

        public Object cache(final JoinPoint joinPoint) throws Throwable {
            MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
            Integer parameter = (Integer) mrtti.getParameterValues()[0];
            Integer cachedValue = (Integer) m_cache.get(parameter);
            if (cachedValue == null) {
                System.err.println("not in cache");
                Object newValue = joinPoint.proceed(); // not found => calculate
                m_cache.put(parameter, newValue);
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    /**
     * @Around execution(int examples.caching.Pi.getPiDecimal(int))
     */
    public Object cache(final JoinPoint joinPoint) throws Throwable {
        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
        final Long hash = new Long(calculateHash(mrtti));
        final Object cachedResult = m_cache.get(hash);
        if (cachedResult != null) {
            System.out.println("using            cache");
            CacheStatistics.addCacheInvocation(mrtti.getName(), mrtti.getParameterTypes());
            System.out.println("parameter: timeout = " + m_info.getParameter("timeout"));
            return cachedResult;
        }
        final Object result = joinPoint.proceed();
        m_cache.put(hash, result);
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

        /**
         * @Around execution(int *..Fibonacci.fib(int))
         */
        public Object cache(final JoinPoint joinPoint) throws Throwable {
            MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
            Integer parameter = (Integer) mrtti.getParameterValues()[0];
            Integer cachedValue = (Integer) m_cache.get(parameter);
            if (cachedValue == null) {
                Object newValue = joinPoint.proceed(); // not found => calculate
                m_cache.put(parameter, newValue);
                return newValue;
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

        /** a static cache to flush it from the outside for demo purpose. Safe since aspect is singleton */
        public static Map s_cache = new HashMap();

        public Object cache(final JoinPoint joinPoint) throws Throwable {
            MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
            Integer parameter = (Integer) mrtti.getParameterValues()[0];
            Integer cachedValue = (Integer) s_cache.get(parameter);
            if (cachedValue == null) {
                System.err.println("not in cache");
                Object newValue = joinPoint.proceed(); // not found => calculate
                s_cache.put(parameter, newValue);
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    /**
     * @Around static_pc9
     */
    public Object advice4(final JoinPoint joinPoint) throws Throwable {
        final Object result = joinPoint.proceed();
        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
        String metadata = joinPoint.getCalleeClass().getName()
                          + mrtti.getMethod().getName()
                          + mrtti.getParameterValues()[0]
                          + mrtti.getParameterTypes()[0].getName()
                          + mrtti.getReturnType().getName()
                          + mrtti.getReturnValue();
        return metadata;
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    /**
     * @Around member_pc10
     */
    public Object advice4(JoinPoint joinPoint) throws Throwable {
        final Object result = joinPoint.proceed();
        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
        String metadata = joinPoint.getCalleeClass().getName()
                          + mrtti.getMethod().getName()
                          + joinPoint.getTarget().hashCode()
                          + mrtti.getParameterValues()[0]
                          + mrtti.getParameterTypes()[0].getName()
                          + mrtti.getReturnType().getName()
                          + mrtti.getReturnValue();
        return metadata;
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

    /**
     * @Around execution(int examples.caching.Pi.getPiDecimal(int))
     */
    public Object cache(final JoinPoint joinPoint) throws Throwable {
        MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
        final Long hash = new Long(calculateHash(mrtti));
        final Object cachedResult = m_cache.get(hash);
        if (cachedResult != null) {
            System.out.println("using            cache");
            CacheStatistics.addCacheInvocation(mrtti.getName(), mrtti.getParameterTypes());
            System.out.println("parameter: timeout = " + m_info.getParameter("timeout"));
            return cachedResult;
        }
        final Object result = joinPoint.proceed();
        m_cache.put(hash, result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.