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.ExternalizableThis 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(java.util.Collection<java.lang.Class<?>> changed)Returnstrueif modifications to any of the classes inchangedresults in a possible invalidation of this query; otherwise returnsfalse.booleanequals(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.StringgetCandidateTypeName()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, java.lang.Object[] args)Return a key for the given query, or null if it is not cacheable.static QueryKeynewInstance(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.voidreadExternal(java.io.ObjectInput in)java.lang.StringtoString()voidwriteExternal(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)
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(java.lang.Object ob)
Determine equality based on identifying information. Keys created for queries that specify a candidate collection are always not equal.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Define a hashing algorithm corresponding to theequals(java.lang.Object)method defined above.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.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.
-
-