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

org.hotrod.runtime.livesql.expressions.Function Maven / Gradle / Ivy

There is a newer version: 4.8.1
Show newest version
package org.hotrod.runtime.livesql.expressions;

import java.util.stream.Stream;

import org.hotrod.runtime.livesql.expressions.binary.ByteArrayFunction;
import org.hotrod.runtime.livesql.expressions.datetime.DateTimeFunction;
import org.hotrod.runtime.livesql.expressions.numbers.NumberFunction;
import org.hotrod.runtime.livesql.expressions.object.ObjectFunction;
import org.hotrod.runtime.livesql.expressions.predicates.BooleanFunction;
import org.hotrod.runtime.livesql.expressions.strings.StringFunction;

public class Function {

  public static NumberFunction returnsNumber(final String pattern, final ComparableExpression... parameters) {
    return new NumberFunction(pattern, parameters) {
    };
  }

  public static StringFunction returnsString(final String pattern, final ComparableExpression... parameters) {
    return new StringFunction(pattern, parameters) {
    };
  }

  public static DateTimeFunction returnsDateTime(final String pattern, final ComparableExpression... parameters) {
    return new DateTimeFunction(pattern, parameters) {
    };
  }

  public static BooleanFunction returnsBoolean(final String pattern, final ComparableExpression... parameters) {
    return new BooleanFunction(pattern, parameters) {
    };
  }

  public static ByteArrayFunction returnsByteArray(final String pattern, final ComparableExpression... parameters) {
    return new ByteArrayFunction(pattern, parameters) {
    };
  }

  public static ObjectFunction returnsObject(final String pattern, final ComparableExpression... parameters) {
    return new ObjectFunction(pattern, parameters) {
    };
  }

  public static ComparableExpression[] bundle(final ComparableExpression a, final ComparableExpression... b) {
    return Stream.concat(Stream.of(a), Stream.of(b)).toArray(ComparableExpression[]::new);
  }

  public static ComparableExpression[] bundle(final ComparableExpression[] a, final ComparableExpression b) {
    return Stream.concat(Stream.of(a), Stream.of(b)).toArray(ComparableExpression[]::new);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy