Package org.apache.velocity.util.introspection

Examples of org.apache.velocity.util.introspection.IntrospectionCacheData


            /*
             *   check the cache
             */
           
            MethodCacheKey mck = new MethodCacheKey(paramClasses);
            IntrospectionCacheData icd =  context.icacheGet( mck );
           
            /*
             *  like ASTIdentifier, if we have cache information, and the
             *  Class of Object o is the same as that in the cache, we are
             *  safe.
             */

            if ( icd != null && (o != null && icd.contextData == o.getClass()) )
            {

                /*
                 * get the method from the cache
                 */

                method = (VelMethod) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and then
                 *  cache it
                 */

                for (int j = 0; j < paramCount; j++)
                    params[j] = jjtGetChild(j + 1).value(context);

                method = rsvc.getUberspect().getMethod(o, methodName, params, new Info(context.getCurrentTemplateName(), getLine(), getColumn()));

                if ((method != null) && (o != null))
                {   
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = method;
                   
                    context.icachePut( mck, icd );
                }
View Full Code Here


            /*
             *   check the cache
             */

            MethodCacheKey mck = new MethodCacheKey(methodName, paramClasses);
            IntrospectionCacheData icd =  context.icacheGet( mck );

            /*
             *  like ASTIdentifier, if we have cache information, and the
             *  Class of Object o is the same as that in the cache, we are
             *  safe.
             */

            if ( icd != null && (o != null && icd.contextData == o.getClass()) )
            {

                /*
                 * get the method from the cache
                 */

                method = (VelMethod) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and then
                 *  cache it
                 */

                method = rsvc.getUberspect().getMethod(o, methodName, params, new Info(context.getCurrentTemplateName(), getLine(), getColumn()));

                if ((method != null) && (o != null))
                {
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = method;

                    context.icachePut( mck, icd );
                }
View Full Code Here

        {
            /*
             *  first, see if we have this information cached.
             */

            IntrospectionCacheData icd = context.icacheGet(this);

            /*
             * if we have the cache data and the class of the object we are
             * invoked with is the same as that in the cache, then we must
             * be allright.  The last 'variable' is the method name, and
             * that is fixed in the template :)
             */

            if ( icd != null && (o != null) && (icd.contextData == o.getClass()) )
            {
                vg = (VelPropertyGet) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and cache it.  Use the
                 *  uberspector
                 */

                vg = rsvc.getUberspect().getPropertyGet(o,identifier, uberInfo);

                if (vg != null && vg.isCacheable() && (o != null))
                {
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = vg;
                    context.icachePut(this,icd);
                }
            }
View Full Code Here

            /*
             *  first, see if we have this information cached.
             */

            IntrospectionCacheData icd = context.icacheGet( this );

            /*
             * if we have the cache data and the class of the object we are
             * invoked with is the same as that in the cache, then we must
             * be allright.  The last 'variable' is the method name, and
             * that is fixed in the template :)
             */

            if ( icd != null && icd.contextData == c )
            {
                 executor = ( AbstractExecutor ) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and cache it
                 */

                executor = doIntrospectionc );
               
                if (executor != null)
                {   
                    icd = new IntrospectionCacheData();
                    icd.contextData = c;
                    icd.thingy = executor;
                    context.icachePut( this, icd );
                }
            }
View Full Code Here

        {
            /*
             *   check the cache
             */

            IntrospectionCacheData icd =  context.icacheGet(this);
            Class c = o.getClass();

            /*
             *  like ASTIdentifier, if we have cache information, and the
             *  Class of Object o is the same as that in the cache, we are
             *  safe.
             */

            if (icd != null && icd.contextData == c)
            {
                /*
                 * sadly, we do need recalc the values of the args, as this can
                 * change from visit to visit
                 */

                for (int j = 0; j < paramCount; j++)
                    params[j] = jjtGetChild(j + 1).value(context);

                /*
                 * and get the method from the cache
                 */

                method = (Method) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and then
                 *  cache it
                 */

                method = doIntrospection(context, c, params);
               
                if (method != null)
                {   
                    icd = new IntrospectionCacheData();
                    icd.contextData = c;
                    icd.thingy = method;
                    context.icachePut( this, icd );
                }
            }
View Full Code Here

         *  Use the introspection cache
         */

        int type = UNKNOWN;

        IntrospectionCacheData icd = context.icacheGet( this );
        Class c = listObject.getClass();

        /*
         *  if we have an entry in the cache, and the Class we have
         *  cached is the same as the Class of the data object
         *  then we are ok
         */

        if ( icd != null && icd.contextData == c )
        {
            /* dig the type out of the cata object */
            type = ((Integer) icd.thingy ).intValue();
        }

        /*
         * If we still don't know what this is,
         * figure out what type of object the list
         * element is, and get the iterator for it
         */

        if ( type == UNKNOWN )
        {
            if ( listObject.getClass().isArray() )
                type = INFO_ARRAY;
            else if ( listObject instanceof Collection)
                type = INFO_COLLECTION;
            else if ( listObject instanceof Map )
                type = INFO_MAP;
            else if ( listObject instanceof Iterator )
                type = INFO_ITERATOR;
            else if ( listObject instanceof Enumeration )
                type = INFO_ENUMERATION;

            /*
             *  if we did figure it out, cache it
             */

            if ( type != UNKNOWN )
            {
                icd = new IntrospectionCacheData();
                icd.thingy = new Integer( type );
                icd.contextData = c;
                context.icachePut( this, icd );
            }
        }
View Full Code Here

        {
            /*
             *  first, see if we have this information cached.
             */

            IntrospectionCacheData icd = context.icacheGet(this);

            /*
             * if we have the cache data and the class of the object we are
             * invoked with is the same as that in the cache, then we must
             * be allright.  The last 'variable' is the method name, and
             * that is fixed in the template :)
             */

            if ( icd != null && (o != null) && (icd.contextData == o.getClass()) )
            {
                vg = (VelPropertyGet) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and cache it.  Use the
                 *  uberspector
                 */

                vg = rsvc.getUberspect().getPropertyGet(o,identifier, uberInfo);

                if (vg != null && vg.isCacheable() && (o != null))
                {
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = vg;
                    context.icachePut(this,icd);
                }
            }
View Full Code Here

            /*
             *   check the cache
             */

            MethodCacheKey mck = new MethodCacheKey(methodName, paramClasses);
            IntrospectionCacheData icd =  context.icacheGet( mck );

            /*
             *  like ASTIdentifier, if we have cache information, and the
             *  Class of Object o is the same as that in the cache, we are
             *  safe.
             */

            if ( icd != null && (o != null && icd.contextData == o.getClass()) )
            {

                /*
                 * get the method from the cache
                 */

                method = (VelMethod) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and then
                 *  cache it
                 */

                for (int j = 0; j < paramCount; j++)
                    params[j] = jjtGetChild(j + 1).value(context);

                method = rsvc.getUberspect().getMethod(o, methodName, params, new Info(context.getCurrentTemplateName(), getLine(), getColumn()));

                if ((method != null) && (o != null))
                {
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = method;

                    context.icachePut( mck, icd );
                }
View Full Code Here

        {
            /*
             *  first, see if we have this information cached.
             */

            IntrospectionCacheData icd = context.icacheGet(this);

            /*
             * if we have the cache data and the class of the object we are
             * invoked with is the same as that in the cache, then we must
             * be allright.  The last 'variable' is the method name, and
             * that is fixed in the template :)
             */

            if ( icd != null && (o != null) && (icd.contextData == o.getClass()) )
            {
                vg = (VelPropertyGet) icd.thingy;
            }
            else
            {
                /*
                 *  otherwise, do the introspection, and cache it.  Use the
                 *  uberspector
                 */

                vg = rsvc.getUberspect().getPropertyGet(o,identifier, uberInfo);

                if (vg != null && vg.isCacheable() && (o != null))
                {
                    icd = new IntrospectionCacheData();
                    icd.contextData = o.getClass();
                    icd.thingy = vg;
                    context.icachePut(this,icd);
                }
            }
View Full Code Here

    {
      /*
       * check the cache
       */
      MethodCacheKey mck = new MethodCacheKey(methodName, paramClasses);
      IntrospectionCacheData icd = context.icacheGet(mck);

      /*
       * like ASTIdentifier, if we have cache information, and the Class of
       * Object o is the same as that in the cache, we are safe.
       */
      if (icd != null && (o != null && icd.contextData == o.getClass()))
      {

        /*
         * get the method from the cache
         */
        method = (VelMethod) icd.thingy;
      }
      else
      {
        /*
         * otherwise, do the introspection, and then cache it
         */
        method = node.getRuntimeServices().getUberspect().getMethod(o, methodName, params,
           new Info(node.getTemplateName(), node.getLine(), node.getColumn()));

        if ((method != null) && (o != null))
        {
          icd = new IntrospectionCacheData();
          icd.contextData = o.getClass();
          icd.thingy = method;

          context.icachePut(mck, icd);
        }
View Full Code Here

TOP

Related Classes of org.apache.velocity.util.introspection.IntrospectionCacheData

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.