001/* 002 * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 006 * which accompanies this distribution. The Eclipse Public License is available 007 * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License 008 * is available at http://www.eclipse.org/org/documents/edl-v10.php. 009 */ 010package javax.persistence; 011 012/** 013 * Type for query parameter objects. 014 * 015 * @param <T> the type of the parameter 016 * @see Query 017 * @see TypedQuery 018 * @since Java Persistence 2.0 019 */ 020public interface Parameter<T> { 021 022 /** 023 * Return the parameter name, or null if the parameter is 024 * not a named parameter or no name has been assigned. 025 * 026 * @return parameter name 027 */ 028 String getName(); 029 030 /** 031 * Return the parameter position, or null if the parameter 032 * is not a positional parameter. 033 * 034 * @return position of parameter 035 */ 036 Integer getPosition(); 037 038 /** 039 * Return the Java type of the parameter. Values bound to the 040 * parameter must be assignable to this type. 041 * This method is required to be supported for criteria queries 042 * only. Applications that use this method for Java 043 * Persistence query language queries and native queries will 044 * not be portable. 045 * 046 * @return the Java type of the parameter 047 * @throws IllegalStateException if invoked on a parameter 048 * obtained from a Java persistence query language 049 * query or native query when the implementation does 050 * not support this use 051 */ 052 Class<T> getParameterType(); 053}