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

info.archinnov.achilles.generated.function.FunctionsRegistry Maven / Gradle / Ivy

There is a newer version: 6.1.0
Show newest version
package info.archinnov.achilles.generated.function;

import com.datastax.driver.core.querybuilder.QueryBuilder;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * This class is the common registry for all registered user-defined functions */
public final class FunctionsRegistry {
  /**
   * Call "convertStringToLong" function with given parameters */
  public static final Long_Type convertStringToLong(final String_Type longValue) {
    final List params = new ArrayList<>();
    if (longValue.isFunctionCall()) {
      params.add(longValue.buildRecursive());
    } else {
      params.add(longValue.hasLiteralValue() ? longValue.getValue() : QueryBuilder.column((String)longValue.getValue()));
    }
    return new Long_Type(Optional.empty()) {
      @Override
      public boolean isFunctionCall() {
        return true;
      }

      @Override
      public String functionName() {
        return "convertStringToLong";
      }

      @Override
      public List parameters() {
        return params;
      }
    };
  }
}