FileDocCategorySizeDatePackage
ParameterMetadata.javaAPI DocHibernate 3.2.52800Fri Jun 02 13:07:08 BST 2006org.hibernate.engine.query

ParameterMetadata

public class ParameterMetadata extends Object implements Serializable
Encapsulates metadata about parameters encountered within a query.
author
Steve Ebersole

Fields Summary
private static final OrdinalParameterDescriptor[]
EMPTY_ORDINALS
private final OrdinalParameterDescriptor[]
ordinalDescriptors
private final Map
namedDescriptorMap
Constructors Summary
public ParameterMetadata(OrdinalParameterDescriptor[] ordinalDescriptors, Map namedDescriptorMap)
Instantiates a ParameterMetadata container.

param
ordinalDescriptors
param
namedDescriptorMap


	        	 
	     
		if ( ordinalDescriptors == null ) {
			this.ordinalDescriptors = EMPTY_ORDINALS;
		}
		else {
			OrdinalParameterDescriptor[] copy = new OrdinalParameterDescriptor[ ordinalDescriptors.length ];
			System.arraycopy( ordinalDescriptors, 0, copy, 0, ordinalDescriptors.length );
			this.ordinalDescriptors = copy;
		}
		if ( namedDescriptorMap == null ) {
			this.namedDescriptorMap = java.util.Collections.EMPTY_MAP;
		}
		else {
			int size = ( int ) ( ( namedDescriptorMap.size() / .75 ) + 1 );
			Map copy = new HashMap( size );
			copy.putAll( namedDescriptorMap );
			this.namedDescriptorMap = java.util.Collections.unmodifiableMap( copy );
		}
	
Methods Summary
public NamedParameterDescriptorgetNamedParameterDescriptor(java.lang.String name)

		NamedParameterDescriptor meta = ( NamedParameterDescriptor ) namedDescriptorMap.get( name );
		if ( meta == null ) {
			throw new QueryParameterException( "could not locate named parameter [" + name + "]" );
		}
		return meta;
	
public org.hibernate.type.TypegetNamedParameterExpectedType(java.lang.String name)

		return getNamedParameterDescriptor( name ).getExpectedType();
	
public java.util.SetgetNamedParameterNames()

		return namedDescriptorMap.keySet();
	
public int[]getNamedParameterSourceLocations(java.lang.String name)

		return getNamedParameterDescriptor( name ).getSourceLocations();
	
public intgetOrdinalParameterCount()

		return ordinalDescriptors.length;
	
public OrdinalParameterDescriptorgetOrdinalParameterDescriptor(int position)

		if ( position < 1 || position > ordinalDescriptors.length ) {
			throw new IndexOutOfBoundsException( "Remember that ordinal parameters are 1-based!" );
		}
		return ordinalDescriptors[position - 1];
	
public org.hibernate.type.TypegetOrdinalParameterExpectedType(int position)

		return getOrdinalParameterDescriptor( position ).getExpectedType();
	
public intgetOrdinalParameterSourceLocation(int position)

		return getOrdinalParameterDescriptor( position ).getSourceLocation();