Package org.apache.openjpa.meta
Class QueryMetaData
java.lang.Object
org.apache.openjpa.meta.QueryMetaData
- All Implemented Interfaces:
Serializable
,SourceTracker
,Commentable
,MetaDataModes
- Direct Known Subclasses:
MultiQueryMetaData
public class QueryMetaData
extends Object
implements MetaDataModes, SourceTracker, Commentable, Serializable
Holds metadata about named queries.
Information stored in this instance gets transfered to
new
Query
instances.- Author:
- Steve Kim
- See Also:
-
Field Summary
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
Constructor Summary
ModifierConstructorDescriptionprotected
QueryMetaData
(String name, boolean convertPositionalParametersToNamed) Construct with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a query hint.The query candidate class, or null if none.int
Return the column number in the line of the file at which this instance was parsed.String[]
Return comments, or empty array if none.The class that defines this query, or null if none.String[]
Query hints.Object[]
Query hints.Return the query language.int
Return the line number of the file at which this instance was parsed.getName()
Return the name for this query.OrderedMap<Object,
Class<?>> The full query string, or null if none.Return the domain-meaningful name of the resource that was loaded from this source.The query result class, or null if none.Return the file from which this instance was parsed.int
The source mode of this query.Return the domain-dependent scope of this instance within its file.int
Return the type of source.boolean
Whether the query has been marked read-only.void
setCandidateType
(Class cls) The query result class, or null if none.void
setColNumber
(int colNum) void
setComments
(String[] comments) Set comments.void
setDefiningType
(Class cls) The class that defines this query, or null if none.void
Initialize this instance from the values held in the specifiedQuery
.void
Set query template information into the given concrete query instance.void
setLanguage
(String language) Set the language for this query.void
setLineNumber
(int lineNum) void
setParamTypes
(OrderedMap<Object, Class<?>> paramTypes) void
setQueryString
(String query) The full query string, or null if none.void
setReadOnly
(boolean readOnly) Whether the query has been marked read-only.void
setResultSetMappingName
(String setMappingName) void
setResultType
(Class cls) The query result class, or null if none.void
void
setSourceMode
(int mode) The source mode of this query.toString()
-
Constructor Details
-
QueryMetaData
Construct with the given name.
-
-
Method Details
-
getName
Return the name for this query. -
getDefiningType
The class that defines this query, or null if none. -
setDefiningType
The class that defines this query, or null if none. -
isReadOnly
public boolean isReadOnly()Whether the query has been marked read-only. -
setReadOnly
public void setReadOnly(boolean readOnly) Whether the query has been marked read-only. -
getCandidateType
The query candidate class, or null if none. -
setCandidateType
The query result class, or null if none. -
getResultType
The query result class, or null if none. -
setResultType
The query result class, or null if none. -
getLanguage
Return the query language. -
setLanguage
Set the language for this query. -
getQueryString
The full query string, or null if none. -
setQueryString
The full query string, or null if none. -
getHintKeys
Query hints. -
getHintValues
Query hints. -
addHint
Add a query hint. -
getResultSetMappingName
-
setResultSetMappingName
-
setInto
Set query template information into the given concrete query instance. However, the language, query string, and candidate class are assumed to be declared in the query instantiation, and hints are not transferred. -
setFrom
Initialize this instance from the values held in the specifiedQuery
. -
getSourceMode
public int getSourceMode()The source mode of this query. -
setSourceMode
public void setSourceMode(int mode) The source mode of this query. -
toString
-
getComments
Description copied from interface:Commentable
Return comments, or empty array if none.- Specified by:
getComments
in interfaceCommentable
-
setComments
Description copied from interface:Commentable
Set comments.- Specified by:
setComments
in interfaceCommentable
-
getSourceFile
Description copied from interface:SourceTracker
Return the file from which this instance was parsed.- Specified by:
getSourceFile
in interfaceSourceTracker
-
getSourceScope
Description copied from interface:SourceTracker
Return the domain-dependent scope of this instance within its file.- Specified by:
getSourceScope
in interfaceSourceTracker
-
getSourceType
public int getSourceType()Description copied from interface:SourceTracker
Return the type of source.- Specified by:
getSourceType
in interfaceSourceTracker
-
setSource
-
getResourceName
Description copied from interface:SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceName
in interfaceSourceTracker
-
getLineNumber
public int getLineNumber()Description copied from interface:SourceTracker
Return the line number of the file at which this instance was parsed.- Specified by:
getLineNumber
in interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum) -
getColNumber
public int getColNumber()Description copied from interface:SourceTracker
Return the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumber
in interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum) -
getSourceName
-
setParamTypes
-
getParamTypes
- Returns:
- a map of parameter name to type for this named query or null if this data hasn't been set.
-