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

org.hibernate.engine.query.spi.AbstractParameterDescriptor Maven / Gradle / Ivy

There is a newer version: 6.5.0.CR2
Show newest version
/*
 * 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.engine.query.spi;

import org.hibernate.Incubating;
import org.hibernate.query.QueryParameter;
import org.hibernate.type.Type;

/**
 * NOTE: Consider this contract (and its sub-contracts) as incubating as we transition to 6.0 and SQM
 *
 * @author Steve Ebersole
 */
@Incubating
public abstract class AbstractParameterDescriptor implements QueryParameter {
	private final int[] sourceLocations;

	private Type expectedType;

	public AbstractParameterDescriptor(int[] sourceLocations, Type expectedType) {
		this.sourceLocations = sourceLocations;
		this.expectedType = expectedType;
	}

	@Override
	public String getName() {
		return null;
	}

	@Override
	public Integer getPosition() {
		return null;
	}

	@Override
	public Class getParameterType() {
		return expectedType == null ? null : expectedType.getReturnedClass();
	}

	@Override
	public Type getHibernateType() {
		return getExpectedType();
	}

	@Override
	public int[] getSourceLocations() {
		return sourceLocations;
	}

	public Type getExpectedType() {
		return expectedType;
	}

	public void resetExpectedType(Type expectedType) {
		this.expectedType = expectedType;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy