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

com.github.dakusui.pcond.Fluents Maven / Gradle / Ivy

package com.github.dakusui.pcond;

import com.github.dakusui.pcond.core.fluent.Fluent;

import java.util.List;

import static java.util.Arrays.asList;

public enum Fluents {
  ;

  public static  Fluent when() {
    return when(value());
  }

  /**
   * Use the value returned from `value()` as the argument for this
   * method as a place-holder for the sake of readability.
   *
   * @param value A value place-holder.
   * @param    The type of the object to be verified.
   * @return A new ObjectTransformer for type `T`.
   */
  public static  Fluent when(T value) {
    return fluent("WHEN");
  }

  public static  Fluent whenValueOfClass(Class klass) {
    return when(value());
  }

  public static  Fluent $() {
    return $(value());
  }
  /**
   * Use this method inside "when" clause.
   *
   * Use the value returned from `value()` as the argument for this
   * method as a place-holder for the sake of readability.
   *
   * [source]
   * ----
   * as((Map)value())
   * ----
   *
   * @param value A value place-holder.
   * @param    The type of the object to be verified.
   * @return A new ObjectTransformer for type `T`.
   */
  public static  Fluent $(T value) {
    return fluent();
  }

  public static  Fluent $valueOfClass(Class klass) {
    return $(value());
  }
  /**
   * Returns a "type place-holder".
   * A type place-holder is a value that can be cast to any class, even if it has
   * a generic type parameters.
   * Note that accessing any field or method of the returned value results in
   * `NullPointerException`.
   *
   * @param  A parameter type of class that the returned value represents.
   * @return A `null` value
   */
  public static  T value() {
    return Fluent.value();
  }

  public static  Fluent fluent() {
    return fluent(null);
  }

  public static  Fluent fluent(String transformerName) {
    return new Fluent<>(transformerName);
  }

  public static List list(Object... args) {
    return asList(args);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy