org.hibernate.query.criteria.internal.expression.AbstractTupleElement 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
JPMS Module-Info's for a few of the Jakarta Libraries just until they add them in themselves
/*
* 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 .
*/
package org.hibernate.query.criteria.internal.expression;
import java.io.Serializable;
import org.hibernate.query.criteria.internal.AbstractNode;
import org.hibernate.query.criteria.internal.CriteriaBuilderImpl;
import org.hibernate.query.criteria.internal.TupleElementImplementor;
import org.hibernate.query.criteria.internal.ValueHandlerFactory;
/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
public abstract class AbstractTupleElement
extends AbstractNode
implements TupleElementImplementor, Serializable {
private final Class originalJavaType;
private Class javaType;
private String alias;
private ValueHandlerFactory.ValueHandler valueHandler;
protected AbstractTupleElement(CriteriaBuilderImpl criteriaBuilder, Class javaType) {
super( criteriaBuilder );
this.originalJavaType = javaType;
this.javaType = javaType;
}
@Override
public Class getJavaType() {
return javaType;
}
@SuppressWarnings({ "unchecked" })
protected void resetJavaType(Class targetType) {
this.javaType = targetType;
// this.valueHandler = javaType.equals( originalJavaType )
// ? null
// : ValueHandlerFactory.determineAppropriateHandler( javaType );
this.valueHandler = ValueHandlerFactory.determineAppropriateHandler( javaType );
}
protected void forceConversion(ValueHandlerFactory.ValueHandler valueHandler) {
this.valueHandler = valueHandler;
}
@Override
public ValueHandlerFactory.ValueHandler getValueHandler() {
return valueHandler;
}
@Override
public String getAlias() {
return alias;
}
/**
* Protected access to define the alias.
*
* @param alias The alias to use.
*/
protected void setAlias(String alias) {
this.alias = alias;
}
}