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

io.hyperfoil.core.steps.UnsetAction Maven / Gradle / Ivy

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

import org.kohsuke.MetaInfServices;

import io.hyperfoil.api.config.InitFromParam;
import io.hyperfoil.api.config.Name;
import io.hyperfoil.api.session.Access;
import io.hyperfoil.api.session.Action;
import io.hyperfoil.api.session.Session;
import io.hyperfoil.core.session.SessionFactory;

public class UnsetAction implements Action {
   public final Access var;

   public UnsetAction(String var) {
      this.var = SessionFactory.access(var);
   }

   @Override
   public void run(Session session) {
      var.unset(session);
   }

   /**
    * Undefine variable name.
    */
   @MetaInfServices(Action.Builder.class)
   @Name("unset")
   public static class Builder implements InitFromParam, Action.Builder {
      private String var;

      public Builder() {
      }

      /**
       * @param param Variable name.
       * @return Self.
       */
      @Override
      public Builder init(String param) {
         var = param;
         return this;
      }

      /**
       * Variable name.
       *
       * @param var Variable name.
       * @return Self.
       */
      public Builder var(String var) {
         this.var = var;
         return this;
      }

      @Override
      public UnsetAction build() {
         return new UnsetAction(var);
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy