Examples of MethodRtti


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 rtti = (MethodRtti)joinPoint.getRtti();
            Integer parameter = (Integer)rtti.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 *..Fibonacci.fib(int))
         */
        public Object cache(final JoinPoint joinPoint) throws Throwable {
            MethodRtti rtti = (MethodRtti)joinPoint.getRtti();
            Integer parameter = (Integer)rtti.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

    /**
     * @Around execution(int examples.caching.Pi.getPiDecimal(int))
     */
    public Object cache(final JoinPoint joinPoint) throws Throwable {
        MethodRtti rtti = (MethodRtti)joinPoint.getRtti();
        final Long hash = new Long(calculateHash(rtti));
        final Object cachedResult = m_cache.get(hash);
        if (cachedResult != null) {
            System.out.println("using cache");
            CacheStatistics.addCacheInvocation(rtti.getName(), rtti.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 member_pc10
     */
    public Object advice4(JoinPoint joinPoint) throws Throwable {
        final Object result = joinPoint.proceed();
        MethodRtti rtti = (MethodRtti)joinPoint.getRtti();
        String metadata = joinPoint.getTargetClass().getName() + rtti.getMethod().getName()
                          + joinPoint.getTargetInstance().hashCode() + rtti.getParameterValues()[0]
                          + rtti.getParameterTypes()[0].getName() + rtti.getReturnType().getName()
                          + rtti.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 rtti = (MethodRtti)joinPoint.getRtti();
      LOG.append("call ");
    }
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 rtti = (MethodRtti) joinPoint.getRtti();
        String metadata = joinPoint.getTargetClass().getName()
            + rtti.getMethod().getName()
            + rtti.getParameterValues()[0]
            + rtti.getParameterTypes()[0].getName()
            + rtti.getReturnType().getName()
            + rtti.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 rtti = (MethodRtti) joinPoint.getRtti();
        String metadata = joinPoint.getTargetClass().getName()
            + rtti.getMethod().getName()
            + joinPoint.getTarget().hashCode()
            + rtti.getParameterValues()[0]
            + rtti.getParameterTypes()[0].getName()
            + rtti.getReturnType().getName()
            + rtti.getReturnValue();
        return metadata;
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.joinpoint.MethodRtti

     * Creates info for the method.
     *
     * @return the created method info
     */
    private static MethodInfo createMethodInfo(final JoinPoint joinPoint) {
        MethodRtti rtti = (MethodRtti)joinPoint.getRtti();
        Method method = rtti.getMethod();
        return JavaMethodInfo.getMethodInfo(method);
    }
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 rtti = (MethodRtti) joinPoint.getRtti();
            Integer parameter = (Integer) rtti.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 *..Fibonacci.fib(int))
         */
        public Object cache(final JoinPoint joinPoint) throws Throwable {
            MethodRtti rtti = (MethodRtti) joinPoint.getRtti();
            Integer parameter = (Integer) rtti.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
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.