org.hibernate.query.sqm.tree.domain.SqmTreatedRoot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.query.sqm.tree.domain;
import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.SemanticQueryWalker;
import org.hibernate.query.sqm.tree.from.SqmRoot;
/**
* @author Steve Ebersole
*/
public class SqmTreatedRoot extends SqmRoot implements SqmTreatedPath {
private final SqmRoot wrappedPath;
private final EntityDomainType treatTarget;
public SqmTreatedRoot(
SqmRoot wrappedPath,
EntityDomainType treatTarget,
NodeBuilder nodeBuilder) {
//noinspection unchecked
super(
(EntityDomainType) wrappedPath.getReferencedPathSource(),
null,
nodeBuilder
);
this.wrappedPath = wrappedPath;
this.treatTarget = treatTarget;
}
@Override
public EntityDomainType getTreatTarget() {
return treatTarget;
}
@Override
public EntityDomainType getManagedType() {
return getTreatTarget();
}
@Override
public SqmPath getWrappedPath() {
return wrappedPath;
}
@Override
public EntityDomainType getReferencedPathSource() {
//noinspection unchecked
return (EntityDomainType) wrappedPath.getReferencedPathSource();
}
@Override
public SqmPath getLhs() {
return wrappedPath.getLhs();
}
@Override
public X accept(SemanticQueryWalker walker) {
return walker.visitTreatedPath( this );
}
}