org.apache.openjpa.meta
Class QueryMetaData

java.lang.Object
  extended by org.apache.openjpa.meta.QueryMetaData
All Implemented Interfaces:
java.io.Serializable, org.apache.openjpa.lib.meta.SourceTracker, org.apache.openjpa.lib.xml.Commentable, MetaDataModes

public class QueryMetaData
extends java.lang.Object
implements MetaDataModes, org.apache.openjpa.lib.meta.SourceTracker, org.apache.openjpa.lib.xml.Commentable, java.io.Serializable

Holds metadata about named queries. Information stored in this instance gets transfered to new Query instances.

Author:
Steve Kim
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
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
 
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
 
Constructor Summary
protected QueryMetaData(java.lang.String name)
          Construct with the given name.
 
Method Summary
 void addHint(java.lang.String key, java.lang.Object value)
          Add a query hint.
 java.lang.Class getCandidateType()
          The query candidate class, or null if none.
 java.lang.String[] getComments()
           
 java.lang.Class getDefiningType()
          The class that defines this query, or null if none.
 java.lang.String[] getHintKeys()
          Query hints.
 java.lang.Object[] getHintValues()
          Query hints.
 java.lang.String getLanguage()
          Return the query language.
 java.lang.String getName()
          Return the name for this query.
 java.lang.String getQueryString()
          The full query string, or null if none.
 java.lang.String getResourceName()
           
 java.lang.String getResultSetMappingName()
           
 java.lang.Class getResultType()
          The query result class, or null if none.
 java.io.File getSourceFile()
           
 int getSourceMode()
          The source mode of this query.
 java.lang.Object getSourceScope()
           
 int getSourceType()
           
 boolean isReadOnly()
          Whether the query has been marked read-only.
 void setCandidateType(java.lang.Class cls)
          The query result class, or null if none.
 void setComments(java.lang.String[] comments)
           
 void setDefiningType(java.lang.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 specified Query.
 void setInto(Query query)
          Set query template information into the given concrete query instance.
 void setLanguage(java.lang.String language)
          Set the language for this query.
 void setQueryString(java.lang.String query)
          The full query string, or null if none.
 void setReadOnly(boolean readOnly)
          Whether the query has been marked read-only.
 void setResultSetMappingName(java.lang.String setMappingName)
           
 void setResultType(java.lang.Class cls)
          The query result class, or null if none.
 void setSource(java.io.File file, java.lang.Object scope, int srcType)
           
 void setSourceMode(int mode)
          The source mode of this query.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryMetaData

protected QueryMetaData(java.lang.String name)
Construct with the given name.

Method Detail

getName

public java.lang.String getName()
Return the name for this query.


getDefiningType

public java.lang.Class getDefiningType()
The class that defines this query, or null if none.


setDefiningType

public void setDefiningType(java.lang.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 java.lang.Class getCandidateType()
The query candidate class, or null if none.


setCandidateType

public void setCandidateType(java.lang.Class cls)
The query result class, or null if none.


getResultType

public java.lang.Class getResultType()
The query result class, or null if none.


setResultType

public void setResultType(java.lang.Class cls)
The query result class, or null if none.


getLanguage

public java.lang.String getLanguage()
Return the query language.


setLanguage

public void setLanguage(java.lang.String language)
Set the language for this query.


getQueryString

public java.lang.String getQueryString()
The full query string, or null if none.


setQueryString

public void setQueryString(java.lang.String query)
The full query string, or null if none.


getHintKeys

public java.lang.String[] getHintKeys()
Query hints.


getHintValues

public java.lang.Object[] getHintValues()
Query hints.


addHint

public void addHint(java.lang.String key,
                    java.lang.Object value)
Add a query hint.


getResultSetMappingName

public java.lang.String getResultSetMappingName()

setResultSetMappingName

public void setResultSetMappingName(java.lang.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 specified Query.


getSourceMode

public int getSourceMode()
The source mode of this query.


setSourceMode

public void setSourceMode(int mode)
The source mode of this query.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getComments

public java.lang.String[] getComments()
Specified by:
getComments in interface org.apache.openjpa.lib.xml.Commentable

setComments

public void setComments(java.lang.String[] comments)
Specified by:
setComments in interface org.apache.openjpa.lib.xml.Commentable

getSourceFile

public java.io.File getSourceFile()
Specified by:
getSourceFile in interface org.apache.openjpa.lib.meta.SourceTracker

getSourceScope

public java.lang.Object getSourceScope()
Specified by:
getSourceScope in interface org.apache.openjpa.lib.meta.SourceTracker

getSourceType

public int getSourceType()
Specified by:
getSourceType in interface org.apache.openjpa.lib.meta.SourceTracker

setSource

public void setSource(java.io.File file,
                      java.lang.Object scope,
                      int srcType)

getResourceName

public java.lang.String getResourceName()
Specified by:
getResourceName in interface org.apache.openjpa.lib.meta.SourceTracker


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.