Class LoadStateDescriptorFactory
java.lang.Object
cz.cvut.kbss.jopa.sessions.descriptor.LoadStateDescriptorFactory
Builds
LoadStateDescriptor
s on various occasions.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> LoadStateDescriptor<T>
create
(T instance, EntityType<T> et) Creates an instance descriptor which sets load status of attributes based on their value in the specified instance as follows:static <T> LoadStateDescriptor<T>
createAllLoaded
(T instance, EntityType<T> et) Creates an instance descriptor which marks all attributes as loaded.static <T> LoadStateDescriptor<T>
createAllUnknown
(T instance, EntityType<T> et) Creates an instance descriptor which marks all attributes except the identifier as having an unknown load state.static <T> LoadStateDescriptor<T>
createCopy
(T instance, LoadStateDescriptor<T> original) Copies the load states from the specified original descriptor into a new descriptor for the specified instance.static <T> LoadStateDescriptor<T>
createNotLoaded
(T instance, EntityType<T> et) Creates an instance descriptor which marks all attributes except the identifier as not loaded.
-
Method Details
-
createNotLoaded
Creates an instance descriptor which marks all attributes except the identifier as not loaded.- Type Parameters:
T
- Instance type- Parameters:
instance
- Instance to create descriptor foret
- Entity type of the instance- Returns:
- Fresh instance descriptor
-
createAllLoaded
Creates an instance descriptor which marks all attributes as loaded.- Type Parameters:
T
- Instance type- Parameters:
instance
- Instance to create descriptor foret
- Entity type of the instance- Returns:
- Fresh instance descriptor with all loaded
-
createAllUnknown
Creates an instance descriptor which marks all attributes except the identifier as having an unknown load state.- Type Parameters:
T
- Instance type- Parameters:
instance
- Instance to create descriptor foret
- Entity type of the instance- Returns:
- Fresh instance descriptor
-
create
Creates an instance descriptor which sets load status of attributes based on their value in the specified instance as follows:If the attribute value is not
null
, its status is set toLoadState.LOADED
. If the value isnull
and the attribute fetch type isFetchType.EAGER
, the status is also set toLOADED
. Otherwise, the status is set toLoadState.UNKNOWN
.- Type Parameters:
T
- Instance type- Parameters:
instance
- Instance to create descriptor foret
- Entity type of the instance- Returns:
- Fresh instance descriptor
-
createCopy
Copies the load states from the specified original descriptor into a new descriptor for the specified instance.- Type Parameters:
T
- Instance type- Parameters:
instance
- Instance to create descriptor fororiginal
- Load state to copy- Returns:
- Fresh instance descriptor with state copied from the specified one
-