diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java deleted file mode 100644 index a65ea791c3..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.relational; - -import org.hibernate.metamodel.mapping.JdbcMapping; - -/** - * @author Steve Ebersole - */ -public interface Column { - String getColumnExpression(); - - Table getTable(); - - JdbcMapping getJdbcMapping(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Formula.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Formula.java deleted file mode 100644 index 119c3303d7..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Formula.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.relational; - -import org.hibernate.metamodel.mapping.JdbcMapping; - -/** - * A read-only expression (e.g. `x + 1`) to which a ModelPart is mapped - * - * @author Steve Ebersole - */ -public class Formula implements Column { - private final Table table; - private final String expression; - private final JdbcMapping jdbcMapping; - - public Formula(Table table, String expression, JdbcMapping jdbcMapping) { - this.table = table; - this.expression = expression; - this.jdbcMapping = jdbcMapping; - } - - public String getExpression() { - return expression; - } - - @Override - public String getColumnExpression() { - return getExpression(); - } - - @Override - public Table getTable() { - return table; - } - - @Override - public JdbcMapping getJdbcMapping() { - return jdbcMapping; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java deleted file mode 100644 index d6ca03f34b..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.relational; - -import java.util.Locale; - -import org.hibernate.dialect.Dialect; -import org.hibernate.internal.util.StringHelper; - -import static org.hibernate.internal.util.StringHelper.safeInterning; - -/** - * Models an identifier (name), which may or may not be quoted. - * - * @author Steve Ebersole - */ -public class Identifier implements Comparable { - private final String text; - private final boolean isQuoted; - - /** - * Means to generate an {@link Identifier} instance from its simple text form. - *

- * If passed text is {@code null}, {@code null} is returned. - *

- * If passed text is surrounded in quote markers, the generated Identifier - * is considered quoted. Quote markers include back-ticks (`), and - * double-quotes ("). - * - * @param text The text form - * - * @return The identifier form, or {@code null} if text was {@code null} - */ - public static Identifier toIdentifier(String text) { - if ( StringHelper.isEmpty( text ) ) { - return null; - } - final String trimmedText = text.trim(); - if ( isQuoted( trimmedText ) ) { - final String bareName = trimmedText.substring( 1, trimmedText.length() - 1 ); - return new Identifier( bareName, true ); - } - else { - return new Identifier( trimmedText, false ); - } - } - - /** - * Means to generate an {@link Identifier} instance from its simple text form. - *

- * If passed text is {@code null}, {@code null} is returned. - *

- * If passed text is surrounded in quote markers, the generated Identifier - * is considered quoted. Quote markers include back-ticks (`), and - * double-quotes ("). - * - * @param text The text form - * @param quote Whether to quote unquoted text forms - * - * @return The identifier form, or {@code null} if text was {@code null} - */ - public static Identifier toIdentifier(String text, boolean quote) { - if ( StringHelper.isEmpty( text ) ) { - return null; - } - final String trimmedText = text.trim(); - if ( isQuoted( trimmedText ) ) { - final String bareName = trimmedText.substring( 1, trimmedText.length() - 1 ); - return new Identifier( bareName, true ); - } - else { - return new Identifier( trimmedText, quote ); - } - } - - /** - * Is the given identifier text considered quoted. The following patterns are - * recognized as quoted:

- *

- * That final form using double-quote (") is the JPA-defined quoting pattern. Although - * it is the standard, it makes for ugly declarations. - */ - public static boolean isQuoted(String name) { - return ( name.startsWith( "`" ) && name.endsWith( "`" ) ) - || ( name.startsWith( "[" ) && name.endsWith( "]" ) ) - || ( name.startsWith( "\"" ) && name.endsWith( "\"" ) ); - } - - /** - * Constructs an identifier instance. - * - * @param text The identifier text. - * @param quoted Is this a quoted identifier? - */ - public Identifier(String text, boolean quoted) { - if ( StringHelper.isEmpty( text ) ) { - throw new IllegalIdentifierException( "Identifier text cannot be null" ); - } - if ( isQuoted( text ) ) { - throw new IllegalIdentifierException( "Identifier text should not contain quote markers (` or \")" ); - } - this.text = text; - this.isQuoted = quoted; - } - - /** - * Get the identifiers name (text) - * - * @return The name - */ - public String getText() { - return text; - } - - /** - * Is this a quoted identifier> - * - * @return True if this is a quote identifier; false otherwise. - */ - public boolean isQuoted() { - return isQuoted; - } - - /** - * If this is a quoted identifier, then return the identifier name - * enclosed in dialect-specific open- and end-quotes; otherwise, - * simply return the unquoted identifier. - * - * @param dialect The dialect whose dialect-specific quoting should be used. - * - * @return if quoted, identifier name enclosed in dialect-specific open- and - * end-quotes; otherwise, the unquoted identifier. - */ - public String render(Dialect dialect) { - return safeInterning( - isQuoted - ? dialect.openQuote() + getText() + dialect.closeQuote() - : getText() - ); - } - - public String render() { - return safeInterning( isQuoted ? '`' + getText() + '`' : getText() ); - } - - public String getCanonicalName() { - return isQuoted ? text : text.toLowerCase( Locale.ENGLISH ); - } - - @Override - public String toString() { - return render(); - } - - @Override - public boolean equals(Object o) { - if ( !(o instanceof Identifier) ) { - return false; - } - - final Identifier that = (Identifier) o; - return getCanonicalName().equals( that.getCanonicalName() ); - } - - @Override - public int hashCode() { - return isQuoted ? text.hashCode() : text.toLowerCase( Locale.ENGLISH ).hashCode(); - } - - public static boolean areEqual(Identifier id1, Identifier id2) { - if ( id1 == null ) { - return id2 == null; - } - else { - return id1.equals( id2 ); - } - } - - public static Identifier quote(Identifier identifier) { - return identifier.isQuoted() - ? identifier - : Identifier.toIdentifier( identifier.getText(), true ); - } - - @Override - public int compareTo(Identifier o) { - return getCanonicalName().compareTo( o.getCanonicalName() ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java deleted file mode 100644 index 6196cbe093..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.relational; - -import org.hibernate.HibernateException; - -/** - * Indicates an attempted use of a name that was deemed illegal - * - * @author Steve Ebersole - */ -public class IllegalIdentifierException extends HibernateException { - public IllegalIdentifierException(String s) { - super( s ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InlineView.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InlineView.java deleted file mode 100644 index 1710fb5559..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InlineView.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.relational; - -/** - * Support for Hibernate's {@link org.hibernate.annotations.Subselect} feature - * - * @author Steve Ebersole - */ -public class InlineView implements Table { - private final String query; - - public InlineView(String query) { - this.query = query; - } - - public String getQuery() { - return query; - } - - @Override - public String getTableExpression() { - return getQuery(); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalColumn.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalColumn.java deleted file mode 100644 index ed090aef40..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalColumn.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.relational; - -import org.hibernate.metamodel.mapping.JdbcMapping; - -/** - * A column physically defined in the database table or inline-view - * - * @author Steve Ebersole - */ -public class PhysicalColumn implements Column { - private final Table table; - private final Identifier columnName; - private final JdbcMapping jdbcMapping; - - public PhysicalColumn(Table table, Identifier columnName, JdbcMapping jdbcMapping) { - this.table = table; - this.columnName = columnName; - this.jdbcMapping = jdbcMapping; - } - - public Identifier getColumnName() { - return columnName; - } - - @Override - public String getColumnExpression() { - return getColumnName().render(); - } - - @Override - public Table getTable() { - return table; - } - - @Override - public JdbcMapping getJdbcMapping() { - return jdbcMapping; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalTable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalTable.java deleted file mode 100644 index a40df28404..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PhysicalTable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.relational; - -/** - * A table (or view, etc) that is physically defined on the database. - * - * @author Steve Ebersole - */ -public class PhysicalTable implements Table { - private final Identifier catalogName; - private final Identifier schemaName; - private final Identifier tableName; - - public PhysicalTable( - Identifier catalogName, - Identifier schemaName, - Identifier tableName) { - this.catalogName = catalogName; - this.schemaName = schemaName; - this.tableName = tableName; - } - - public Identifier getCatalogName() { - return catalogName; - } - - public Identifier getSchemaName() { - return schemaName; - } - - public Identifier getTableName() { - return tableName; - } - - @Override - public String getTableExpression() { - return getTableName().render(); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/RuntimeRelationModelHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/RuntimeRelationModelHelper.java deleted file mode 100644 index 80a768f236..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/RuntimeRelationModelHelper.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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.relational; - -/** - * @author Steve Ebersole - */ -public class RuntimeRelationModelHelper { - public static final String DEFAULT_COLUMN_WRITE_EXPRESSION = "?"; - - private RuntimeRelationModelHelper() { - // disallow direct instantiation - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java deleted file mode 100644 index adb5ee912c..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * 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.relational; - -/** - * @author Steve Ebersole - */ -public interface Table { - String getTableExpression(); -}