FileDocCategorySizeDatePackage
ColumnCollectionAliases.javaAPI DocHibernate 3.2.53353Fri Oct 14 17:43:44 BST 2005org.hibernate.loader.custom

ColumnCollectionAliases

public class ColumnCollectionAliases extends Object implements org.hibernate.loader.CollectionAliases
CollectionAliases that uses columnnames instead of generated aliases. Aliases can still be overwritten via
author
Max Rydahl Andersen

Fields Summary
private final String[]
keyAliases
private final String[]
indexAliases
private final String[]
elementAliases
private final String
identifierAlias
private Map
userProvidedAliases
Constructors Summary
public ColumnCollectionAliases(Map userProvidedAliases, org.hibernate.persister.collection.SQLLoadableCollection persister)

		this.userProvidedAliases = userProvidedAliases;

		this.keyAliases = getUserProvidedAliases(
				"key", 
				persister.getKeyColumnNames()
			);

		this.indexAliases = getUserProvidedAliases(
				"index",
				persister.getIndexColumnNames()
				);
		
		this.elementAliases = getUserProvidedAliases( "element", 
				persister.getElementColumnNames()
				);
				
		this.identifierAlias = getUserProvidedAlias( "id", 
				persister.getIdentifierColumnName()
				);
	
	
Methods Summary
public java.lang.StringgetSuffix()
Returns the suffix used to unique the column aliases for this particular alias set.

return
The uniqued column alias suffix.

		return "";
	
public java.lang.String[]getSuffixedElementAliases()
Returns the suffixed result-set column-aliases for the columns making up the collection's elements.

return
The element result-set column aliases.

		return elementAliases;
	
public java.lang.StringgetSuffixedIdentifierAlias()
Returns the suffixed result-set column-aliases for the column defining the collection's identifier (if any).

return
The identifier result-set column aliases.

		return identifierAlias;
	
public java.lang.String[]getSuffixedIndexAliases()
Returns the suffixed result-set column-aliases for the collumns making up the collection's index (map or list).

return
The index result-set column aliases.

		return indexAliases;
	
public java.lang.String[]getSuffixedKeyAliases()
Returns the suffixed result-set column-aliases for columns making up the key for this collection (i.e., its FK to its owner).

return
The key result-set column aliases.

		return keyAliases;
	
private java.lang.StringgetUserProvidedAlias(java.lang.String propertyPath, java.lang.String defaultAlias)

		String[] columns = (String[]) userProvidedAliases.get(propertyPath);
		if (columns==null) {
			return defaultAlias;
		} 
		else {
			return columns[0];
		}
	
private java.lang.String[]getUserProvidedAliases(java.lang.String propertyPath, java.lang.String[] defaultAliases)

		String[] result = (String[]) userProvidedAliases.get(propertyPath);
		if (result==null) {
			return defaultAliases;			
		} 
		else {
			return result;
		}
	
private java.lang.Stringjoin(java.lang.String[] aliases)

		if ( aliases == null) return null;

		return StringHelper.join( ", ", aliases );
	
public java.lang.StringtoString()

		return super.toString() + " [ suffixedKeyAliases=[" + join( keyAliases ) +
		        "], suffixedIndexAliases=[" + join( indexAliases ) +
		        "], suffixedElementAliases=[" + join( elementAliases ) +
		        "], suffixedIdentifierAlias=[" + identifierAlias + "]]";