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 newQuery
instances.- Author:
- Steve Kim
- See Also:
- Serialized Form
-
-
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
Constructors Modifier Constructor Description protected
QueryMetaData(String name, boolean convertPositionalParametersToNamed)
Construct with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHint(String key, Object value)
Add a query hint.Class
getCandidateType()
The query candidate class, or null if none.int
getColNumber()
String[]
getComments()
Class
getDefiningType()
The class that defines this query, or null if none.String[]
getHintKeys()
Query hints.Object[]
getHintValues()
Query hints.String
getLanguage()
Return the query language.int
getLineNumber()
String
getName()
Return the name for this query.OrderedMap<Object,Class<?>>
getParamTypes()
String
getQueryString()
The full query string, or null if none.String
getResourceName()
String
getResultSetMappingName()
Class
getResultType()
The query result class, or null if none.File
getSourceFile()
int
getSourceMode()
The source mode of this query.String
getSourceName()
Object
getSourceScope()
int
getSourceType()
boolean
isReadOnly()
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)
void
setDefiningType(Class cls)
The class that defines this query, or null if none.void
setFrom(Query query)
Initialize this instance from the values held in the specifiedQuery
.void
setInto(Query query)
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
setSource(File file, Object scope, int srcType, String srcName)
void
setSourceMode(int mode)
The source mode of this query.String
toString()
-
-
-
Constructor Detail
-
QueryMetaData
protected QueryMetaData(String name, boolean convertPositionalParametersToNamed)
Construct with the given name.
-
-
Method Detail
-
getName
public String getName()
Return the name for this query.
-
getDefiningType
public Class getDefiningType()
The class that defines this query, or null if none.
-
setDefiningType
public void setDefiningType(Class cls)
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
public Class getCandidateType()
The query candidate class, or null if none.
-
setCandidateType
public void setCandidateType(Class cls)
The query result class, or null if none.
-
getResultType
public Class getResultType()
The query result class, or null if none.
-
setResultType
public void setResultType(Class cls)
The query result class, or null if none.
-
getLanguage
public String getLanguage()
Return the query language.
-
setLanguage
public void setLanguage(String language)
Set the language for this query.
-
getQueryString
public String getQueryString()
The full query string, or null if none.
-
setQueryString
public void setQueryString(String query)
The full query string, or null if none.
-
getHintKeys
public String[] getHintKeys()
Query hints.
-
getHintValues
public Object[] getHintValues()
Query hints.
-
getResultSetMappingName
public String getResultSetMappingName()
-
setResultSetMappingName
public void setResultSetMappingName(String setMappingName)
-
setInto
public void setInto(Query query)
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
public void setFrom(Query query)
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.
-
getComments
public String[] getComments()
- Specified by:
getComments
in interfaceCommentable
-
setComments
public void setComments(String[] comments)
- Specified by:
setComments
in interfaceCommentable
-
getSourceFile
public File getSourceFile()
- Specified by:
getSourceFile
in interfaceSourceTracker
-
getSourceScope
public Object getSourceScope()
- Specified by:
getSourceScope
in interfaceSourceTracker
-
getSourceType
public int getSourceType()
- Specified by:
getSourceType
in interfaceSourceTracker
-
getResourceName
public String getResourceName()
- Specified by:
getResourceName
in interfaceSourceTracker
-
getLineNumber
public int getLineNumber()
- Specified by:
getLineNumber
in interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum)
-
getColNumber
public int getColNumber()
- Specified by:
getColNumber
in interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum)
-
getSourceName
public String getSourceName()
-
setParamTypes
public void setParamTypes(OrderedMap<Object,Class<?>> paramTypes)
-
getParamTypes
public OrderedMap<Object,Class<?>> getParamTypes()
- Returns:
- a map of parameter name to type for this named query or null if this data hasn't been set.
-
-