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

com.github.dakusui.jcunit.fsm.Args Maven / Gradle / Ivy

There is a newer version: 0.8.17
Show newest version
package com.github.dakusui.jcunit.fsm;

import com.github.dakusui.jcunit.core.utils.Checks;
import com.github.dakusui.jcunit.core.utils.StringUtils;
import com.github.dakusui.jcunit.core.utils.Utils;

import java.io.Serializable;
import java.lang.reflect.Type;

public class Args implements Serializable {
  private final Object[] values;

  public Args(Object[] values) {
    Checks.checknotnull(values);
    this.values = values;
  }

  public Object[] values() {
    return this.values;
  }

  public int size() {
    return this.values.length;
  }

  public Type[] types() {
    return Utils.transformLazily(
        Utils.asList(this.values),
        new Utils.Form() {
          @Override
          public Type apply(Object in) {
            return in != null
                ? in.getClass()
                : null;
          }
        }).toArray(new Type[this.values.length]);
  }

  @Override
  public String toString() {
    return StringUtils.format("[%s]", StringUtils.join(",", values));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy