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

org.hibernate.cfg.PropertyHolder Maven / Gradle / Ivy

There is a newer version: 6.6.2.Final
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.cfg;

import javax.persistence.Column;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;

import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;

/**
 * Property holder abstract property containers from their direct implementation
 *
 * @author Emmanuel Bernard
 */
public interface PropertyHolder {
	String getClassName();

	String getEntityOwnerClassName();

	Table getTable();

	void addProperty(Property prop, XClass declaringClass);

	void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass);

	KeyValue getIdentifier();

	/**
	 * Return true if this component is or is embedded in a @EmbeddedId
	 */
	boolean isOrWithinEmbeddedId();

	/**
	 * Return true if this component is within an @ElementCollection.
	 */
	boolean isWithinElementCollection();

	PersistentClass getPersistentClass();

	boolean isComponent();

	boolean isEntity();

	void setParentProperty(String parentProperty);

	String getPath();

	/**
	 * return null if the column is not overridden, or an array of column if true
	 */
	Column[] getOverriddenColumn(String propertyName);

	/**
	 * return null if the column is not overridden, or an array of column if true
	 */
	JoinColumn[] getOverriddenJoinColumn(String propertyName);

	/**
	 * return null if hte foreign key is not overridden, or the foreign key if true
	 */
	default ForeignKey getOverriddenForeignKey(String propertyName) {
		// todo: does this necessarily need to be a default method?
		return null;
	}

	/**
	 * return
	 *  - null if no join table is present,
	 *  - the join table if not overridden,
	 *  - the overridden join table otherwise
	 */
	JoinTable getJoinTable(XProperty property);

	String getEntityName();

	Join addJoin(JoinTable joinTableAnn, boolean noDelayInPkColumnCreation);

	boolean isInIdClass();

	void setInIdClass(Boolean isInIdClass);

	/**
	 * Called during binding to allow the PropertyHolder to inspect its discovered properties.  Mainly
	 * this is used in collecting attribute conversion declarations (via @Convert/@Converts).
	 *
	 * @param property The property
	 */
	void startingProperty(XProperty property);

	/**
	 * Determine the AttributeConverter to use for the given property.
	 *
	 * @param property
	 * @return The ConverterDescriptor
	 */
	ConverterDescriptor resolveAttributeConverterDescriptor(XProperty property);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy