Package org.apache.openjpa.datacache
Class QueryKey
- java.lang.Object
 - 
- org.apache.openjpa.datacache.QueryKey
 
 
- 
- All Implemented Interfaces:
 Externalizable,Serializable
public class QueryKey extends Object implements Externalizable
This class stores information about a particular invocation of a query. It contains a reference to the external properties of the query that was executed, as well as any parameters used to execute that query, with one exception: first-class objects used as parameter values are converted to OIDs.- Author:
 - Patrick Linskey
 - See Also:
 - Serialized Form
 
 
- 
- 
Constructor Summary
Constructors Constructor Description QueryKey()Public constructor for externalization only. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanchangeInvalidatesQuery(Collection<Class<?>> changed)Returnstrueif modifications to any of the classes inchangedresults in a possible invalidation of this query; otherwise returnsfalse.booleanequals(Object ob)Determine equality based on identifying information.Set<String>getAcessPathClassNames()Returns the set of the accessPathClassnames that exists in the queryStringgetCandidateTypeName()Returns the candidate class name for this query.intgetTimeout()Return the amount of time this key is good for.inthashCode()Define a hashing algorithm corresponding to theequals(java.lang.Object)method defined above.static QueryKeynewInstance(Query q)Return a key for the given query, or null if it is not cacheable.static QueryKeynewInstance(Query q, Object[] args)Return a key for the given query, or null if it is not cacheable.static QueryKeynewInstance(Query q, Map<Object,Object> args)Return a key for the given query, or null if it is not cacheable.voidreadExternal(ObjectInput in)StringtoString()voidwriteExternal(ObjectOutput out) 
 - 
 
- 
- 
Method Detail
- 
newInstance
public static QueryKey newInstance(Query q)
Return a key for the given query, or null if it is not cacheable. 
- 
newInstance
public static QueryKey newInstance(Query q, Object[] args)
Return a key for the given query, or null if it is not cacheable. 
- 
newInstance
public static QueryKey newInstance(Query q, Map<Object,Object> args)
Return a key for the given query, or null if it is not cacheable. 
- 
getCandidateTypeName
public String getCandidateTypeName()
Returns the candidate class name for this query. 
- 
getTimeout
public int getTimeout()
Return the amount of time this key is good for. 
- 
changeInvalidatesQuery
public boolean changeInvalidatesQuery(Collection<Class<?>> changed)
Returnstrueif modifications to any of the classes inchangedresults in a possible invalidation of this query; otherwise returnsfalse. Invalidation is possible if one or more of the classes in this query key's access path has been changed. 
- 
equals
public boolean equals(Object ob)
Determine equality based on identifying information. Keys created for queries that specify a candidate collection are always not equal. 
- 
hashCode
public int hashCode()
Define a hashing algorithm corresponding to theequals(java.lang.Object)method defined above. 
- 
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
 writeExternalin interfaceExternalizable- Throws:
 IOException
 
- 
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
 readExternalin interfaceExternalizable- Throws:
 IOExceptionClassNotFoundException
 
 - 
 
 -