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

io.hyperfoil.core.session.ObjectVar Maven / Gradle / Ivy

There is a newer version: 0.27.1
Show newest version
package io.hyperfoil.core.session;

import io.hyperfoil.api.session.Session;

public class ObjectVar implements Session.Var {
   boolean set;
   Object value;

   public static ObjectVar[] newArray(Session session, int size) {
      ObjectVar[] array = new ObjectVar[size];
      for (int i = 0; i < array.length; ++i) array[i] = new ObjectVar((SessionImpl) session);
      return array;
   }

   ObjectVar(SessionImpl session) {
      session.registerVar(this);
   }

   @Override
   public Session.VarType type() {
      return Session.VarType.OBJECT;
   }

   @Override
   public Object objectValue(Session session) {
      return value;
   }

   @Override
   public boolean isSet() {
      return set;
   }

   @Override
   public void unset() {
      set = false;
   }

   public Object get() {
      assert set;
      return value;
   }

   public void set(Object value) {
      this.value = value;
      this.set = true;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy