org.hibernate.metamodel.model.domain.spi.AbstractSingularPersistentAttribute 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.metamodel.model.domain.spi;
import org.hibernate.boot.model.domain.PersistentAttributeMapping;
import org.hibernate.property.access.spi.PropertyAccess;
/**
* @author Steve Ebersole
*/
public abstract class AbstractSingularPersistentAttribute
extends AbstractPersistentAttribute
implements SingularPersistentAttribute {
private final Disposition disposition;
public AbstractSingularPersistentAttribute(
ManagedTypeDescriptor runtimeContainer,
PersistentAttributeMapping bootAttribute,
PropertyAccess propertyAccess,
Disposition disposition) {
super(
runtimeContainer,
bootAttribute,
propertyAccess
);
this.disposition = disposition;
}
@Override
public Disposition getDisposition() {
return disposition;
}
@Override
public boolean isId() {
return getDisposition() == Disposition.ID;
}
@Override
public boolean isVersion() {
return getDisposition() == Disposition.VERSION;
}
@Override
public boolean isCollection() {
return false;
}
@Override
public boolean isAssociation() {
return getPersistentAttributeType() == PersistentAttributeType.MANY_TO_ONE
|| getPersistentAttributeType() == PersistentAttributeType.ONE_TO_ONE;
}
@Override
public SimpleTypeDescriptor getAttributeType() {
return getType();
}
@Override
public BindableType getBindableType() {
return BindableType.SINGULAR_ATTRIBUTE;
}
@Override
public Class getBindableJavaType() {
return getJavaTypeDescriptor().getJavaType();
}
}