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

io.github.sinri.keel.mysql.statement.templated.TemplateArgumentMapping Maven / Gradle / Ivy

Go to download

A website framework with VERT.X for ex-PHP-ers, exactly Ark Framework Users.

The newest version!
package io.github.sinri.keel.mysql.statement.templated;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.HashMap;

/**
 * @since 3.0.8
 */
public class TemplateArgumentMapping extends HashMap {
    public TemplateArgumentMapping bindNull(@Nonnull String argumentName) {
        this.put(argumentName, TemplateArgument.forNull());
        return this;
    }

    public TemplateArgumentMapping bindNumber(@Nonnull String argumentName, @Nonnull Number number) {
        this.put(argumentName, TemplateArgument.forNumber(number));
        return this;
    }

    /**
     * @param numbers      Ensure not empty or use with bindLineCommentStarting
     */
    public TemplateArgumentMapping bindNumbers(@Nonnull String argumentName, @Nonnull Collection numbers) {
        this.put(argumentName, TemplateArgument.forNumbers(numbers));
        return this;
    }

    public TemplateArgumentMapping bindString(@Nonnull String argumentName, @Nonnull String string) {
        this.put(argumentName, TemplateArgument.forString(string));
        return this;
    }

    /**
     * @param strings      Ensure not empty or use with bindLineCommentStarting
     */
    public TemplateArgumentMapping bindStrings(@Nonnull String argumentName, @Nonnull Collection strings) {
        this.put(argumentName, TemplateArgument.forStrings(strings));
        return this;
    }

    public TemplateArgumentMapping bindExpression(@Nonnull String argumentName, @Nonnull String expression) {
        this.put(argumentName, TemplateArgument.forExpression(expression));
        return this;
    }

    /**
     * @param expressions  Ensure not empty or use with bindLineCommentStarting
     */
    public TemplateArgumentMapping bindExpressions(@Nonnull String argumentName, @Nonnull Collection expressions) {
        this.put(argumentName, TemplateArgument.forExpressions(expressions));
        return this;
    }

    /**
     * @since 3.0.11
     */
    public TemplateArgumentMapping bindLineCommentStarting(@Nonnull String argumentName, boolean commentFromHere) {
        this.put(argumentName, TemplateArgument.forExpression((commentFromHere ? "-- " : " ")));
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy