All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jagg.model.SelfMethodCall Maven / Gradle / Ivy

Go to download

jAgg is a Java 5.0 API that supports “group by” operations on Lists of Java objects: aggregate operations such as count, sum, max, min, avg, and many more. It also allows custom aggregate operations.

The newest version!
package net.sf.jagg.model;

import net.sf.jagg.model.ChainedMethodCall;

/**
 * A SelfMethodCall is a MethodCall that simply
 * returns its own object, instead of invoking a Method on that
 * object.
 *
 * @author Randy Gettman
 * @since 0.5.0
 */
public class SelfMethodCall extends ChainedMethodCall
{
   private Object myPrototype;

   /**
    * Constructs a SelfMethodCall around an object.
    * @param prototype A prototype object.
    */
   public SelfMethodCall(Object prototype)
   {
      myPrototype = prototype;
   }

   /**
    * Returns the return type of the MethodCall, which is in this
    * case the type of the object prototype.
    * @return A Class object representing the return type of the
    *    method, which is in this case the type of the object prototype.
    */
   @Override
   public Class getReturnType()
   {
      return myPrototype.getClass();
   }

   /**
    * Returns the object itself without invoking any Methods.
    * @param object The object on which to "invoke" the Method.
    * @return The object itself.
    */
   @Override
   protected Object invokeMethod(Object object)
   {
      return object;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy