org.apache.openjpa.jdbc.meta
Class QueryResultMapping

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

public class QueryResultMapping
extends Object
implements MetaDataModes, SourceTracker, Commentable

Mapping of a query result set to scalar and/or persistence-capable object-level values.

Author:
Pinaki Poddar, Abe White

Nested Class Summary
 class QueryResultMapping.PCResult
          A persistence-capable result.
 
Field Summary
 
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
 
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
 
Constructor Summary
QueryResultMapping(String name, MappingRepository repos)
          Construct with the given name.
 
Method Summary
 void addColumnResult(Object id)
          Add the id of a mapped column in the query result.
 QueryResultMapping.PCResult addPCResult(Class<?> candidate)
          Add a mapped persistence-capable result with the given candidate type.
 int getColNumber()
          Return the column number in the line of the file at which this instance was parsed.
 Object[] getColumnResults()
          Ids of mapped scalar columns in the result.
 String[] getComments()
          Return comments, or empty array if none.
 Class<?> getDefiningType()
          The class that defines this query result, or null if none.
 int getLineNumber()
          Return the line number of the file at which this instance was parsed.
 int getListingIndex()
          Relative order of result mapping in metadata.
 String getName()
          Return the name for this query result.
 QueryResultMapping.PCResult[] getPCResults()
          Return the mapped persistence-capable types in the query result.
 String getResourceName()
          Return the domain-meaningful name of the resource that was loaded from this source.
 File getSourceFile()
          Return the file from which this instance was parsed.
 int getSourceMode()
          The source mode of this query result.
 Object getSourceScope()
          Return the domain-dependent scope of this instance within its file.
 int getSourceType()
          Return the type of source.
 void setColNumber(int colNum)
           
 void setComments(String[] comments)
          Set comments.
 void setDefiningType(Class<?> cls)
          The class that defines this query result, or null if none.
 void setLineNumber(int lineNum)
           
 void setListingIndex(int idx)
          Relative order of result mapping in metadata.
 void setSource(File file, Object scope, int srcType)
           
 void setSourceMode(int mode)
          The source mode of this query result.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryResultMapping

QueryResultMapping(String name,
                   MappingRepository repos)
Construct with the given name.

Method Detail

getName

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


getDefiningType

public Class<?> getDefiningType()
The class that defines this query result, or null if none.


setDefiningType

public void setDefiningType(Class<?> cls)
The class that defines this query result, or null if none.


getColumnResults

public Object[] getColumnResults()
Ids of mapped scalar columns in the result. These will typically be column names.

See Also:
Result

addColumnResult

public void addColumnResult(Object id)
Add the id of a mapped column in the query result. This will typically be a column name.

See Also:
Result

getPCResults

public QueryResultMapping.PCResult[] getPCResults()
Return the mapped persistence-capable types in the query result.


addPCResult

public QueryResultMapping.PCResult addPCResult(Class<?> candidate)
Add a mapped persistence-capable result with the given candidate type.


getSourceMode

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


setSourceMode

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


getListingIndex

public int getListingIndex()
Relative order of result mapping in metadata.


setListingIndex

public void setListingIndex(int idx)
Relative order of result mapping in metadata.


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

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

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

setColNumber

public void setColNumber(int colNum)


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