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

org.hibernate.type.AdaptedImmutableType Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
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.type;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.MutabilityPlan;

/**
 * Optimize a mutable type, if the user promises not to mutable the
 * instances.
 * 
 * @author Gavin King
 * @author Steve Ebersole
 */
public class AdaptedImmutableType extends AbstractSingleColumnStandardBasicType {
	private final AbstractStandardBasicType baseMutableType;

	public AdaptedImmutableType(AbstractStandardBasicType baseMutableType) {
		super( baseMutableType.getSqlTypeDescriptor(), baseMutableType.getJavaTypeDescriptor() );
		this.baseMutableType = baseMutableType;
	}

	@Override
	@SuppressWarnings({ "unchecked" })
	protected MutabilityPlan getMutabilityPlan() {
		return ImmutableMutabilityPlan.INSTANCE;
	}

	public String getName() {
		return "imm_" + baseMutableType.getName();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy