tech.ydb.yoj.databind.expression.LeafExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yoj-databind Show documentation
Show all versions of yoj-databind Show documentation
Core data-binding logic used by YOJ (YDB ORM for Java) to convert
between Java objects and database rows (or anything representable by
a Java Map, really).
The newest version!
package tech.ydb.yoj.databind.expression;
import com.google.common.collect.ImmutableList;
import lombok.NonNull;
import tech.ydb.yoj.databind.schema.Schema.JavaField;
import java.util.List;
public abstract class LeafExpression implements FilterExpression {
@Override
public final List> getChildren() {
return List.of();
}
public final java.lang.reflect.Type getFieldType() {
var field = getField();
return field.isFlat() ? field.getFlatFieldType() : field.getType();
}
public final String getFieldName() {
return getField().getName();
}
public final String getFieldPath() {
return getField().getPath();
}
public abstract JavaField getField();
public abstract boolean isGenerated();
@Override
public FilterExpression and(@NonNull FilterExpression other) {
if (other instanceof AndExpr) {
return new AndExpr<>(getSchema(), ImmutableList.>builder()
.add(this)
.addAll(other.getChildren())
.build());
}
return FilterExpression.super.and(other);
}
@Override
public FilterExpression or(@NonNull FilterExpression other) {
if (other instanceof OrExpr) {
return new OrExpr<>(getSchema(), ImmutableList.>builder()
.add(this)
.addAll(other.getChildren())
.build());
}
return FilterExpression.super.or(other);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy