| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.persistence.HintHandler
public class HintHandler
Manages query hint keys and handles their values on behalf of a owning
 QueryImpl. Uses specific knowledge of hint keys declared in
 different parts of the system.
 
 This receiver collects hint keys from different parts of the system. The
 keys are implicitly or explicitly declared by several different mechanics.
 This receiver sets the values on behalf of a owning QueryImpl
 based on the its specific knowledge of these keys.
 
 The hint keys from following sources are collected and handled: 
 
 1. QueryHints interface declares hint keys
    as public static final fields. These fields are collected by reflection.
    The values are handled by invoking methods on the owning QueryImpl
    
 2. Some hint keys are collected from bean-style property names of JDBCFetchPlan by reflection and prefixed with openjpa.FetchPlan. 
    Their values are used to set the corresponding property of FetchPlan via reflection
      
 3. Currently defined javax.persistence.* hint keys have  
    a equivalent counterpart to one of these FetchPlan keys. 
    The JPA keys are mapped to equivalent FetchPlan hint keys.
    
 4. Some keys directly invoke setters or add listeners to the owning 
    QueryImpl. These hint keys are statically declared in 
    this receiver itself. 
    
 5. ProductDerivation may introduce their own query hint keys via ProductDerivation.getSupportedQueryHints(). Their values are set in the 
    FetchConfiguration.setHint(String, Object)
     
  A hint key is classified into one of the following three categories:
  
  1. Supported: A key is known to this receiver as collected from different 
     parts of the system. The value of a supported key is recorded and 
     available via getHints() method. 
  2. Recognized: A key is not known to this receiver but has a prefix which
     is known to this receiver. The value of a recognized key is not recorded 
     but its value is available via FetchConfiguration.getHint(String)
  3. Unrecognized: A key is neither supported nor recognized. The value of a 
     unrecognized key is neither recorded nor set anywhere.
  
  If an incompatible value is supplied for a supported key, a non-fatal
  ArgumentException is raised.
| Field Summary | |
|---|---|
| protected static Set<String> | _supportedHints | 
| protected  QueryImpl<?> | owner | 
| protected static String | PREFIX_FETCHPLAN | 
| protected static String | PREFIX_JDBC | 
| protected static String | PREFIX_OPENJPA | 
| Constructor Summary | |
|---|---|
| HintHandler(QueryImpl<?> impl) | |
| Method Summary | |
|---|---|
|  Map<String,Object> | getHints()Gets all the recorded hint keys and their values. | 
|  Set<String> | getSupportedHints()Gets all the supported hint keys. | 
| protected  boolean | isKnownPrefix(String key)Affirms if the given key starts with any of the known prefix. | 
| protected  Boolean | record(String hint,
       Object value)Record a key-value pair only only if the given key is supported. | 
|  void | setHint(String key,
        Object value) | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected final QueryImpl<?> owner
protected static Set<String> _supportedHints
protected static final String PREFIX_OPENJPA
protected static final String PREFIX_JDBC
protected static final String PREFIX_FETCHPLAN
| Constructor Detail | 
|---|
HintHandler(QueryImpl<?> impl)
| Method Detail | 
|---|
protected Boolean record(String hint,
                         Object value)
public void setHint(String key,
                    Object value)
protected boolean isKnownPrefix(String key)
key - 
public Set<String> getSupportedHints()
public Map<String,Object> getHints()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||