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

org.babyfish.jimmer.sql.ast.query.Example Maven / Gradle / Ivy

There is a newer version: 0.9.19
Show newest version
package org.babyfish.jimmer.sql.ast.query;

import org.babyfish.jimmer.View;
import org.babyfish.jimmer.lang.NewChain;
import org.babyfish.jimmer.meta.TypedProp;
import org.babyfish.jimmer.sql.ast.LikeMode;
import org.babyfish.jimmer.sql.ast.impl.ExampleImpl;

public interface Example {

    static  Example of(E obj) {
        if (obj instanceof View) {
            throw new IllegalArgumentException(
                    "entity cannot be view, " +
                            "please call another overloaded function whose parameter is view"
            );
        }
        return new ExampleImpl<>(obj);
    }

    static  Example of(View view) {
        return new ExampleImpl<>(view.toEntity());
    }

    @NewChain
    Example match(MatchMode mode);

    @NewChain
    Example match(TypedProp prop, MatchMode matchMode);

    @NewChain
    Example trim();

    @NewChain
    Example trim(TypedProp.Scalar prop);

    @NewChain
    default Example like(TypedProp.Scalar prop) {
        return like(prop, LikeMode.ANYWHERE);
    }

    @NewChain
    Example like(TypedProp.Scalar prop, LikeMode likeMode);

    @NewChain
    default Example ilike(TypedProp.Scalar prop) {
        return ilike(prop, LikeMode.ANYWHERE);
    }

    @NewChain
    Example ilike(TypedProp.Scalar prop, LikeMode likeMode);

    @NewChain
    Example ignoreZero(TypedProp.Scalar prop);

    enum MatchMode {
        NOT_EMPTY,
        NOT_NULL,
        NULLABLE
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy