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

org.hibernate.boot.model.source.internal.hbm.XmlElementMetadata 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.boot.model.source.internal.hbm;

import java.util.Locale;

/**
 * Provides meta-information about XML elements.
 *
 * @author Steve Ebersole
 */
public enum XmlElementMetadata {
	/**
	 * Describes the {@code } element
	 */
	ID( true, true ),
	/**
	 * Describes the {@code } element
	 */
	COMPOSITE_ID( false, true ),
	/**
	 * Describes the {@code } element
	 */
	DISCRIMINATOR( true, false ),
	/**
	 * Describes the {@code } element
	 */
	MULTI_TENANCY( true, false ),
	/**
	 * Describes the {@code } element
	 */
	VERSION( true, true ),
	/**
	 * Describes the {@code } element
	 */
	TIMESTAMP( true, true ),
	/**
	 * Describes the {@code } element
	 */
	NATURAL_ID( false, false ),
	/**
	 * Describes the {@code } element
	 */
	PROPERTIES( false, true ),
	/**
	 * Describes the {@code } element
	 */
	PROPERTY( false, true ),
	/**
	 * Describes the {@code } element
	 */
	KEY_PROPERTY( false, true ),
	/**
	 * Describes the {@code } element
	 */
	MANY_TO_ONE( false, true ),
	/**
	 * Describes the {@code } element
	 */
	KEY_MANY_TO_ONE( false, true ),
	/**
	 * Describes the {@code } element
	 */
	ONE_TO_ONE( false, true ),
	/**
	 * Describes the {@code } element
	 */
	ANY( false, true ),
	/**
	 * Describes the {@code } element
	 */
	COMPONENT( false, true ),
	/**
	 * Describes the {@code } element
	 */
	KEY( false, false ),
	/**
	 * Describes the {@code } element
	 */
	SET( false, true ),
	/**
	 * Describes the {@code } element
	 */
	LIST( false, true ),
	/**
	 * Describes the {@code } element
	 */
	BAG( false, true ),
	/**
	 * Describes the {@code } element
	 */
	ID_BAG( false, true ),
	/**
	 * Describes the {@code } element
	 */
	MAP( false, true ),
	/**
	 * Describes the {@code } element
	 */
	ARRAY( false, true ),
	/**
	 * Describes the {@code } element
	 */
	PRIMITIVE_ARRAY( false, true ),
	/**
	 * Describes the {@code } element
	 */
	COLLECTION_ID( true, false ),
	/**
	 * Describes the {@code } element
	 */
	ELEMENT( false, false ),
	/**
	 * Describes the {@code } element
	 */
	MANY_TO_MANY( false, false ),
	/**
	 * Describes the {@code } element
	 */
	MANY_TO_ANY( false, false ),
	/**
	 * Describes the {@code } element
	 */
	MAP_KEY( false, false ),
	/**
	 * Describes the {@code } element
	 */
	MAP_KEY_MANY_TO_MANY( false, false ),

	/**
	 * Describes the {@code } element
	 */
	INDEX( false, false ),
	/**
	 * Describes the {@code } element
	 */
	INDEX_MANY_TO_MANY( false, false ),
	/**
	 * Describes the {@code } element
	 */
	LIST_INDEX( true, false );

	private final boolean inherentlySingleColumn;
	private final boolean canBeNamed;

	XmlElementMetadata(boolean inherentlySingleColumn, boolean canBeNamed) {
		this.inherentlySingleColumn = inherentlySingleColumn;
		this.canBeNamed = canBeNamed;
	}

	/**
	 * The corresponding {@code hbm.xml} element name.  Used in error reporting
	 *
	 * @return The {@code hbm.xml} element name
	 */
	public String getElementName() {
		return name().toLowerCase(Locale.ROOT);
	}

	/**
	 * Can this source, by nature, define just a single column/formula?
	 *
	 * @return {@code true} indicates that the source will refer to just a
	 * single column.
	 */
	public boolean isInherentlySingleColumn() {
		return inherentlySingleColumn;
	}

	/**
	 * Can the source be named.  This is used in implicit naming (naming strategy).
	 *
	 * @return {@code true} indicates that the source can be named and therefore
	 * the column (assuming just one) is eligible for implicit naming.
	 */
	public boolean canBeNamed() {
		return canBeNamed;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy