Class QueryHintsHandler
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.QueryHintsHandler
-
public class QueryHintsHandler extends java.lang.Object
The class processes query hints. EclipseLink query hints and their values defined in org.eclipse.persistence.config package. To add a new query hint: Define a new hint in QueryHints; Add a class containing hint's values if required to config package (like CacheUsage); Alternatively values defined in HintValues may be used - Refresh and BindParameters hints do that. Add an inner class to this class extending Hint corresponding to the new hint (like CacheUsageHint); The first constructor parameter is hint name; the second is default value; In constructor provide 2-dimensional value array in case the values should be translated (currently all Hint classes do that); in case translation is not required provide a single-dimension array (no such examples yet). In inner class Hint static initializer addHint an instance of the new hint class (like addHint(new CacheUsageHint())).- See Also:
QueryHints
,HintValues
,CacheUsage
,PessimisticLock
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
QUERY_HINT_PROPERTY
-
Constructor Summary
Constructors Constructor Description QueryHintsHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.persistence.queries.DatabaseQuery
apply(java.lang.String hintName, java.lang.Object hintValue, org.eclipse.persistence.queries.DatabaseQuery query, java.lang.ClassLoader loader, org.eclipse.persistence.internal.sessions.AbstractSession activeSession)
Applies the hint to the query.static org.eclipse.persistence.queries.DatabaseQuery
apply(java.util.Map<java.lang.String,java.lang.Object> hints, org.eclipse.persistence.queries.DatabaseQuery query, java.lang.ClassLoader loader, org.eclipse.persistence.internal.sessions.AbstractSession activeSession)
Applies the hints to the query.static java.util.Set<java.lang.String>
getSupportedHints()
static boolean
parseBooleanHint(java.lang.Object hint)
Common hint value processing into an boolean value.static int
parseIntegerHint(java.lang.Object hint, java.lang.String hintName)
Common hint value processing into an integer value.protected static boolean
shouldUseDefault(java.lang.Object hintValue)
Empty String hintValue indicates that the default hint value should be used.static void
verify(java.lang.String hintName, java.lang.Object hintValue, java.lang.String queryName, org.eclipse.persistence.internal.sessions.AbstractSession session)
Verifies the hint.static void
verify(java.util.Map hints, java.lang.String queryName, org.eclipse.persistence.internal.sessions.AbstractSession session)
Verifies the hints.
-
-
-
Field Detail
-
QUERY_HINT_PROPERTY
public static final java.lang.String QUERY_HINT_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
verify
public static void verify(java.util.Map hints, java.lang.String queryName, org.eclipse.persistence.internal.sessions.AbstractSession session)
Verifies the hints. If session != null then logs a FINEST message for each hint. queryName parameter used only for identifying the query in messages, if it's null then "null" will be used. Throws IllegalArgumentException in case the hint value is illegal.
-
verify
public static void verify(java.lang.String hintName, java.lang.Object hintValue, java.lang.String queryName, org.eclipse.persistence.internal.sessions.AbstractSession session)
Verifies the hint. If session != null then logs a FINEST message. queryName parameter used only for identifying the query in messages, if it's null then "null" will be used. Throws IllegalArgumentException in case the hint value is illegal.
-
apply
public static org.eclipse.persistence.queries.DatabaseQuery apply(java.util.Map<java.lang.String,java.lang.Object> hints, org.eclipse.persistence.queries.DatabaseQuery query, java.lang.ClassLoader loader, org.eclipse.persistence.internal.sessions.AbstractSession activeSession)
Applies the hints to the query. Throws IllegalArgumentException in case the hint value is illegal.
-
apply
public static org.eclipse.persistence.queries.DatabaseQuery apply(java.lang.String hintName, java.lang.Object hintValue, org.eclipse.persistence.queries.DatabaseQuery query, java.lang.ClassLoader loader, org.eclipse.persistence.internal.sessions.AbstractSession activeSession)
Applies the hint to the query. Throws IllegalArgumentException in case the hint value is illegal.
-
parseBooleanHint
public static boolean parseBooleanHint(java.lang.Object hint)
Common hint value processing into an boolean value. If the hint is null, false is returned. Those methods that need to handle a null hint to be something other than false should not call this method.
-
parseIntegerHint
public static int parseIntegerHint(java.lang.Object hint, java.lang.String hintName)
Common hint value processing into an integer value. If the hint is null, -1 is returned.
-
shouldUseDefault
protected static boolean shouldUseDefault(java.lang.Object hintValue)
Empty String hintValue indicates that the default hint value should be used.
-
getSupportedHints
public static java.util.Set<java.lang.String> getSupportedHints()
-
-