Package org.apache.openjpa.datacache
Class QueryKey
- java.lang.Object
-
- org.apache.openjpa.datacache.QueryKey
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
public class QueryKey extends java.lang.Object implements java.io.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 boolean
changeInvalidatesQuery(java.util.Collection<java.lang.Class<?>> changed)
Returnstrue
if modifications to any of the classes inchanged
results in a possible invalidation of this query; otherwise returnsfalse
.boolean
equals(java.lang.Object ob)
Determine equality based on identifying information.java.util.Set<java.lang.String>
getAcessPathClassNames()
Returns the set of the accessPathClassnames that exists in the queryjava.lang.String
getCandidateTypeName()
Returns the candidate class name for this query.int
getTimeout()
Return the amount of time this key is good for.int
hashCode()
Define a hashing algorithm corresponding to theequals(java.lang.Object)
method defined above.static QueryKey
newInstance(Query q)
Return a key for the given query, or null if it is not cacheable.static QueryKey
newInstance(Query q, java.lang.Object[] args)
Return a key for the given query, or null if it is not cacheable.static QueryKey
newInstance(Query q, java.util.Map<java.lang.Object,java.lang.Object> args)
Return a key for the given query, or null if it is not cacheable.void
readExternal(java.io.ObjectInput in)
java.lang.String
toString()
void
writeExternal(java.io.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, java.lang.Object[] args)
Return a key for the given query, or null if it is not cacheable.
-
newInstance
public static QueryKey newInstance(Query q, java.util.Map<java.lang.Object,java.lang.Object> args)
Return a key for the given query, or null if it is not cacheable.
-
getCandidateTypeName
public java.lang.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(java.util.Collection<java.lang.Class<?>> changed)
Returnstrue
if modifications to any of the classes inchanged
results 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(java.lang.Object ob)
Determine equality based on identifying information. Keys created for queries that specify a candidate collection are always not equal.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Define a hashing algorithm corresponding to theequals(java.lang.Object)
method defined above.- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
getAcessPathClassNames
public java.util.Set<java.lang.String> getAcessPathClassNames()
Returns the set of the accessPathClassnames that exists in the query- Returns:
- -- Returns a set of accesspath classnames.
-
-