org.apache.openjpa.meta
Class QueryMetaData

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

public class QueryMetaData
extends Object
implements MetaDataModes, SourceTracker, Commentable

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

Author:
Steve Kim

Field Summary
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
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(String name)
          Construct with the given name.
 
Method Summary
 void addHint(String key, Object value)
          Add a query hint.
 Class getCandidateType()
          The query candidate class, or null if none.
 String[] getComments()
          Return comments, or empty array if none.
 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.
 String getName()
          Return the name for this query.
 String getQueryString()
          The full query string, or null if none.
 String getResourceName()
          Return the domain-meaningful name of the resource that was loaded from this source.
 Class getResultType()
          The query result class, or null if none.
 File getSourceFile()
          Return the file from which this instance was parsed.
 int getSourceMode()
          The source mode of this query.
 Object getSourceScope()
          Return the domain-dependent scope of this instance within its file.
 int getSourceType()
          Return the type of source.
 boolean isReadOnly()
          Whether the query has been marked read-only.
 void setCandidateType(Class cls)
          The query result class, or null if none.
 void setComments(String[] comments)
          Set 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 specified Query.
 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 setQueryString(String query)
          The full query string, or null if none.
 void setReadOnly(boolean readOnly)
          Whether the query has been marked read-only.
 void setResultType(Class cls)
          The query result class, or null if none.
 void setSource(File file, Object scope, int srcType)
           
 void setSourceMode(int mode)
          The source mode of this query.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryMetaData

protected QueryMetaData(String name)
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.


addHint

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


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 String toString()
Overrides:
toString in class Object

getComments

public String[] getComments()
Description copied from interface: Commentable
Return comments, or empty array if none.

Specified by:
getComments in interface Commentable

setComments

public void setComments(String[] comments)
Description copied from interface: Commentable
Set comments.

Specified by:
setComments in interface Commentable

getSourceFile

public File getSourceFile()
Description copied from interface: SourceTracker
Return the file from which this instance was parsed.

Specified by:
getSourceFile in interface SourceTracker

getSourceScope

public Object getSourceScope()
Description copied from interface: SourceTracker
Return the domain-dependent scope of this instance within its file.

Specified by:
getSourceScope in interface SourceTracker

getSourceType

public int getSourceType()
Description copied from interface: SourceTracker
Return the type of source.

Specified by:
getSourceType in interface SourceTracker

setSource

public void setSource(File file,
                      Object scope,
                      int srcType)

getResourceName

public String 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 interface SourceTracker


Copyright © 2006 Apache Software Foundation. All Rights Reserved.