Class FetchPlanForClass
java.lang.Object
org.datanucleus.FetchPlanForClass
Representation of the fetch plan for a particular class, defining the members that are to be fetched.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AbstractClassMetaDataMetaData for the class that this represents.(package private) booleanWhether the record is dirty and needs the fields recalculating.private Map<Integer, Set<FetchGroupMetaData>> Cache of fetch groups by member number, as calculating them in getFetchGroupsForMemberNumber() is O(n^2) Mapinvalid input: '<'Integer, Set> (package private) int[]Absolute numbers of fields/properties in the fetch plan for this class.(package private) final FetchPlanParent FetchPlan. -
Constructor Summary
ConstructorsConstructorDescriptionFetchPlanForClass(AbstractClassMetaData cmd, FetchPlan fetchPlan) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal AbstractClassMetaDataAccessor for the MetaData for this classes plan.(package private) FetchPlanForClassReturns a copy of this object with all settings initialised.private Set<FetchGroupMetaData> getFetchGroupsForMemberNumber(Set<FetchGroupMetaData> fgmds, int memberNum) Get all the (MetaData-based) fetch groups where this member number is included.final FetchPlanAccessor for the FetchPlan that this classes plan relates to.int[]Get the absolute numbers of the members in the fetch plan for this class.Get all members (of this class, and superclasses) in the fetch plan.private BitSetGet all members in the fetch plan for this class and superclasses.private BitSetGet the absolute member numbers for a particular Fetch Group.private BitSetGet the absolute number of the members for an array of Fetch Group.intgetRecursionDepthForMember(int memberNum) Method to return the recursion depth of this member number in the overall fetch plan.booleanhasMember(int memberNumber) Return whether the specified field/property is in the fetch planbooleanisToCallPostLoadFetchPlan(boolean[] loadedMembers) Whether to call the post load or not.(package private) voidprivate voidSets the given BitSet of member numbers to include all the members.private voidsetAsDefault(BitSet memberNums) Sets the given BitSet of member numbers to include the DFG members.private voidSets the given BitSet of member numbers to include none of the members (except the PKs).toString()
-
Field Details
-
plan
Parent FetchPlan. -
cmd
MetaData for the class that this represents. -
memberNumbers
int[] memberNumbersAbsolute numbers of fields/properties in the fetch plan for this class. -
dirty
boolean dirtyWhether the record is dirty and needs the fields recalculating. -
recursionDepthByMemberNumber
-
fetchGroupsByMemberNumber
Cache of fetch groups by member number, as calculating them in getFetchGroupsForMemberNumber() is O(n^2) Mapinvalid input: '<'Integer, Set>
-
-
Constructor Details
-
FetchPlanForClass
Constructor.- Parameters:
cmd- MetaData for the classfetchPlan- the FetchPlan
-
-
Method Details
-
getFetchPlan
Accessor for the FetchPlan that this classes plan relates to.- Returns:
- The FetchPlan
-
getAbstractClassMetaData
Accessor for the MetaData for this classes plan.- Returns:
- MetaData for the class represented here
-
toString
-
markDirty
void markDirty() -
getCopy
Returns a copy of this object with all settings initialised. Used when a Query has to have its own FetchPlan, so takes a copy of that of the ExecutionContext.- Returns:
- the FetchPlanForClass copy
-
getRecursionDepthForMember
public int getRecursionDepthForMember(int memberNum) Method to return the recursion depth of this member number in the overall fetch plan.- Parameters:
memberNum- Number of member in this class- Returns:
- The recursion depth
-
hasMember
public boolean hasMember(int memberNumber) Return whether the specified field/property is in the fetch plan- Parameters:
memberNumber- The member number- Returns:
- Whether it is in the FetchPlan
-
getMemberNumbers
public int[] getMemberNumbers()Get the absolute numbers of the members in the fetch plan for this class.- Returns:
- an array with the absolute position of the members
-
getMemberNumbersByBitSet
Get all members (of this class, and superclasses) in the fetch plan.- Returns:
- an BitSet with the bits set in the absolute position of the fields
-
getMemberNumbersByBitSet
Get all members in the fetch plan for this class and superclasses.- Parameters:
cmd- metadata for the class- Returns:
- an BitSet with the bits set in the absolute position of the members
-
getMemberNumbersForFetchGroups
Get the absolute number of the members for an array of Fetch Group.- Parameters:
fgmds- The Fetch Groups- Returns:
- a BitSet with flags set to true in the member number positions
-
getMemberNumbersForFetchGroup
Get the absolute member numbers for a particular Fetch Group.- Parameters:
fgmd- The Fetch Group- Returns:
- a list of member numbers
-
setAsDefault
Sets the given BitSet of member numbers to include the DFG members.- Parameters:
memberNums- BitSet of member numbers
-
setAsAll
Sets the given BitSet of member numbers to include all the members.- Parameters:
memberNums- BitSet of member numbers
-
setAsNone
Sets the given BitSet of member numbers to include none of the members (except the PKs).- Parameters:
memberNums- BitSet of member numbers
-
isToCallPostLoadFetchPlan
public boolean isToCallPostLoadFetchPlan(boolean[] loadedMembers) Whether to call the post load or not. Checks if members in actual FetchPlan where not previouly loaded and the post-load is enabled in the metadata.- Parameters:
loadedMembers- already loaded members- Returns:
- if is to call the postLoad
-
getFetchGroupsForMemberNumber
private Set<FetchGroupMetaData> getFetchGroupsForMemberNumber(Set<FetchGroupMetaData> fgmds, int memberNum) Get all the (MetaData-based) fetch groups where this member number is included.- Parameters:
fgmds- The Fetch GroupsmemberNum- the member absolute number- Returns:
- The Fetch Groups
-