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

org.infinispan.commons.util.ByRef Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.commons.util;

/**
 * This class can be used to pass an argument by reference.
 * @param  The wrapped type.
 *
 * @author Dan Berindei
 * @since 5.1
 */
public class ByRef {
   private T ref;

   public ByRef(T t) {
      ref = t;
   }

   public static  ByRef create(T t) {
      return new ByRef(t);
   }

   public T get() {
      return ref;
   }

   public void set(T t) {
      ref = t;
   }

	/**
    * Implementation for primitive type
    */
   public static class Boolean {
      boolean ref;

      public Boolean(boolean b) {
         ref = b;
      }

      public boolean get() {
         return ref;
      }

      public void set(boolean b) {
         this.ref = b;
      }
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy