Class FetchConfigurationImpl

    • Method Detail

      • populateHintSetter

        protected static void populateHintSetter​(java.lang.Class<?> target,
                                                 java.lang.String hint,
                                                 java.lang.Class<?> type,
                                                 java.lang.String... prefixes)
        Populate static registry of hints.
        Parameters:
        target - The name of the target class that will receive this hint.
        hint - the simple name of the hint without a prefix.
        type - the value argument type of the target setter method.
        prefixes - the prefixes will be added to the simple hint name.
      • populateHintSetter

        protected static void populateHintSetter​(java.lang.Class<?> target,
                                                 java.lang.String method,
                                                 java.lang.String hint,
                                                 java.lang.Class<?> type,
                                                 java.lang.String... prefixes)
        Populate static registry of hints.
        Parameters:
        target - The name of the target class that will receive this hint.
        method - The name of the method in the target class that will receive this hint.
        hint - the simple name of the hint without a prefix.
        type - the value argument type of the target setter method.
        prefixes - the prefixes will be added to the simple hint name.
      • setContext

        public void setContext​(StoreContext ctx)
        Description copied from interface: FetchConfiguration
        Called automatically by the system to associate the fetch configuration with a context before use. The fetch configuration properties should be synchronized with the context's configuration object. Subclasses for specific back ends cannot rely on the context's configuration implementing their back end's configuration sub-interface.
        Specified by:
        setContext in interface FetchConfiguration
      • clone

        public java.lang.Object clone()
        Clone this instance.
        Specified by:
        clone in interface FetchConfiguration
        Overrides:
        clone in class java.lang.Object
      • getFetchBatchSize

        public int getFetchBatchSize()
        Description copied from interface: FetchConfiguration
        Return the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.
        Specified by:
        getFetchBatchSize in interface FetchConfiguration
      • setFetchBatchSize

        public FetchConfiguration setFetchBatchSize​(int fetchBatchSize)
        Description copied from interface: FetchConfiguration
        Set the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.
        Specified by:
        setFetchBatchSize in interface FetchConfiguration
      • setMaxFetchDepth

        public FetchConfiguration setMaxFetchDepth​(int depth)
        Description copied from interface: FetchConfiguration
        Set the maximum depth of the fetched instance graph.
        Specified by:
        setMaxFetchDepth in interface FetchConfiguration
        Parameters:
        depth - denotes limiting length of traversal path from a root instance. -1 implies no limit. 0 is not permissible.
      • getQueryCacheEnabled

        public boolean getQueryCacheEnabled()
        Description copied from interface: FetchConfiguration
        Return whether or not query caching is enabled. If this returns true but the datacache plugin is not installed, caching will not be enabled. If this returns false, query caching will not be used even if the datacache plugin is installed.
        Specified by:
        getQueryCacheEnabled in interface FetchConfiguration
      • getFetchGroups

        public java.util.Set<java.lang.String> getFetchGroups()
        Description copied from interface: FetchConfiguration
        Returns immutable set of names of the fetch groups that this component will use when loading objects. Defaults to the openjpa.FetchGroups setting. This set is not thread safe.
        Specified by:
        getFetchGroups in interface FetchConfiguration
      • hasFetchGroupDefault

        public boolean hasFetchGroupDefault()
      • hasFetchGroupAll

        public boolean hasFetchGroupAll()
      • clearFetchGroups

        public FetchConfiguration clearFetchGroups()
        Description copied from interface: FetchConfiguration
        Clears the set of fetch group names to use when loading data. After this operation is invoked, only those fields in the default fetch group (and any requested field) will be loaded when loading an object.
        Specified by:
        clearFetchGroups in interface FetchConfiguration
      • getFields

        public java.util.Set<java.lang.String> getFields()
        Description copied from interface: FetchConfiguration
        Returns the set of fully-qualified field names that this component will use when loading objects. Defaults to the empty set. This set is not thread safe.
        Specified by:
        getFields in interface FetchConfiguration
      • hasField

        public boolean hasField​(java.lang.String field)
        Description copied from interface: FetchConfiguration
        Return true if the given fully-qualified field has been added.
        Specified by:
        hasField in interface FetchConfiguration
      • clearFields

        public FetchConfiguration clearFields()
        Description copied from interface: FetchConfiguration
        Clears the set of field names to use when loading data. After this operation is invoked, only those fields in the configured fetch groups will be loaded when loading an object.
        Specified by:
        clearFields in interface FetchConfiguration
      • getHints

        public java.util.Map<java.lang.String,​java.lang.Object> getHints()
        Gets the current hints set on this receiver. The values designate the actual value specified by the caller and not the values that may have been actually set on the state variables of this receiver.
        Specified by:
        getHints in interface FetchConfiguration
      • isHintSet

        public boolean isHintSet​(java.lang.String key)
        Affirms if the given key is set as a hint.
        Specified by:
        isHintSet in interface FetchConfiguration
      • removeHint

        public void removeHint​(java.lang.String... keys)
        Removes the given keys and their hint value.
      • getSupportedHints

        public java.util.Collection<java.lang.String> getSupportedHints()
      • setHint

        public void setHint​(java.lang.String key,
                            java.lang.Object value)
        Same as setHint(key, value, value).
        Specified by:
        setHint in interface FetchConfiguration
        value - the value of the hint. If the hint has a corresponding setter, then the type of value must be same as the setter argument.
        See Also:
        setHint(String, Object, Object)
      • setHint

        public void setHint​(java.lang.String key,
                            java.lang.Object value,
                            java.lang.Object original)
        Sets the hint to the given value. If the key corresponds to a known key, then that value is set via the setter method. Otherwise it is put into opaque hints map.
        In either case, the original value is put in the hints map. So essential difference between setting a value directly by a setter and via a hint is the memory of this original value.
        The other important difference is setting lock levels. Setting of lock level via setter method needs active transaction. But setting via hint does not.
        Specified by:
        setHint in interface FetchConfiguration
        Parameters:
        key - a hint key. If it is one of the statically registered hint key then the setter is called.
        value - to be set. The given value type must match the argument type of the setter, if one exists.
        original - value as specified by the caller. This value is put in the hints map.
        Throws:
        java.lang.IllegalArgumentException - if the given value is not acceptable by the setter method, if one exists corresponds the given hint key.
      • getHint

        public java.lang.Object getHint​(java.lang.String name)
        Description copied from interface: FetchConfiguration
        Get the hint value for the specific key as originally set by the caller, or null if the hint is not specified.
        Specified by:
        getHint in interface FetchConfiguration
      • removeHint

        public java.lang.Object removeHint​(java.lang.String name)
      • getRootClasses

        public java.util.Set<java.lang.Class<?>> getRootClasses()
        Description copied from interface: FetchConfiguration
        Root classes for recursive operations. This set is not thread safe.
        Specified by:
        getRootClasses in interface FetchConfiguration
      • getRootInstances

        public java.util.Set<java.lang.Object> getRootInstances()
        Description copied from interface: FetchConfiguration
        Root instances for recursive operations. This set is not thread safe.
        Specified by:
        getRootInstances in interface FetchConfiguration
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        protected java.lang.String toString​(java.lang.Object o)