java.lang.Object
io.ebean.bean.InterceptReadOnly
- All Implemented Interfaces:
EntityBeanIntercept,Serializable
EntityBeanIntercept optimised for read only use.
For the read only use this intercept doesn't need to hold any state that is normally required for updates such as per property changed, dirty state, original values bean state etc.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd and return a dirty property hash.voidaddDirtyPropertyNames(Set<String> props, String prefix) Recursively add dirty properties.voidaddDirtyPropertyValues(BeanDiffVisitor visitor) Recursively add dirty properties.voidaddDirtyPropertyValues(Map<String, ValuePair> dirtyValues, String prefix) Recursively add dirty properties.voidClear the getter callback.boolean[]Return the array of flags indicating the dirty properties.Return a dirty property hash taking into account embedded beans.Return the set of dirty properties.Return a map of dirty properties with their new and old values.Return the owning bean for an embedded bean.intReturn the property index (for the parent) of this embedded bean.final intfindProperty(String propertyName) Finds the index position of a given property.booleanfreeze()Return true if this entity bean should be frozen.booleanhasDirtyProperty(Set<String> propertyNames) Return true if any of the given property names are dirty.booleanhasIdOnly(int idIndex) Return true if only the Id property has been loaded.voidinitialisedMany(int propertyIndex) Called when a BeanCollection is initialised automatically.booleanisChangedProp(int i) Return true if the property has its changed state set.booleanisChangedProperty(int propertyIndex) Return true if the property is considered changed.booleanisDirty()Return true if this bean has been directly modified (it has oldValues) or if any embedded beans are either new or dirty (and hence need saving).booleanisDirtyProperty(int propertyIndex) Return true if the property was changed or if it is embedded and one of its embedded properties is dirty.booleanReturn true if lazy loading is disabled.booleanisEmbeddedNewOrDirty(Object embeddedBean) Return true if the embedded bean is new or dirty and hence needs saving.final booleanReturn true if the bean is fully loaded (not a partial).booleanReturn true if the bean is marked as having failed lazy loading.booleanisLoaded()Return true if the entity has been loaded.booleanReturn true if this bean was loaded from L2 bean cache.booleanisLoadedProperty(int propertyIndex) Return true if the property is loaded.booleanisNew()Return true if this entity bean is new and not yet saved.booleanReturn true if the entity bean is new or dirty (and should be saved).booleanReturn true if the bean was orphan deleted from a collection.booleanReturn true if the bean is partially loaded.booleanReturn true if the entity is a reference.booleanisUpdate()Return true if the entity should be updated.Return the property that triggered the lazy load.intReturn the index of the property that triggered the lazy load.voidloadBean(int loadProperty) Load the bean when it is a reference.voidloadBeanInternal(int loadProperty, BeanLoader loader) Invoke the lazy loading.boolean[]loaded()Return the loaded state for all the properties.final StringBuilderReturn a loaded property hash.Return the set of property names for a partially loaded bean.Returns the loadErrors.voidmarkPropertyAsChanged(int propertyIndex) Explicitly mark a property as having been changed.mutableInfo(int propertyIndex) Return the MutableValueInfo for the given property or null.voidmutableInfo(int propertyIndex, MutableValueInfo info) Set the MutableValueInfo for the given property.mutableNext(int propertyIndex) Update the 'next' mutable info returning the content that was obtained via dirty detection.voidmutableNext(int propertyIndex, MutableValueNext next) Dirty detection set the next mutable property content and info .origValue(int propertyIndex) Return the original value that was changed via an update.final EntityBeanowner()Return the 'owning' entity bean.ownerId()Return the ownerId (IdClass).Return the persistenceContext.voidpreGetId()Called prior to Id property getter.voidpreGetter(int propertyIndex) Method that is called prior to a getter method on the actual entity.voidpreGetterCallback(int propertyIndex) Invoke the PreGetterCallback if it has been set due to getter for the given property.voidpreSetter(boolean intercept, int propertyIndex, boolean oldValue, boolean newValue) Check for primitive boolean.voidpreSetter(boolean intercept, int propertyIndex, byte[] oldValue, byte[] newValue) Check for primitive byte array.voidpreSetter(boolean intercept, int propertyIndex, byte oldValue, byte newValue) Check for primitive byte.voidpreSetter(boolean intercept, int propertyIndex, char[] oldValue, char[] newValue) Check for primitive char array.voidpreSetter(boolean intercept, int propertyIndex, char oldValue, char newValue) Check for primitive char.voidpreSetter(boolean intercept, int propertyIndex, double oldValue, double newValue) Check for primitive double.voidpreSetter(boolean intercept, int propertyIndex, float oldValue, float newValue) Check for primitive float.voidpreSetter(boolean intercept, int propertyIndex, int oldValue, int newValue) Check for primitive int.voidpreSetter(boolean intercept, int propertyIndex, long oldValue, long newValue) Check for primitive long.voidpreSetter(boolean intercept, int propertyIndex, short oldValue, short newValue) Check for primitive short.voidCheck to see if the values are not equal.voidpreSetterMany(boolean interceptField, int propertyIndex, Object oldValue, Object newValue) OneToMany and ManyToMany only set loaded state.final Stringproperty(int propertyIndex) Return the property name for the given property.intReturn the number of properties.voidregisterGetterCallback(PreGetterCallback getterCallback) Register the callback to be triggered when getter is called.voidsetBeanLoader(BeanLoader beanLoader) Set the BeanLoader.voidsetBeanLoader(BeanLoader beanLoader, PersistenceContext ctx) Set the BeanLoader with PersistenceContext.voidsetChangedProperty(int propertyIndex) Set the changed state for the given property.voidsetChangedPropertyValue(int propertyIndex, boolean setDirtyState, Object origValue) Set the property changed state, bean dirtyState and property original value.voidsetChangeLoaded(int propertyIndex) Set the changed and loaded state for the given property.voidsetDeletedFromCollection(boolean deletedFromCollection) Set if the entity was deleted from a BeanCollection.voidsetDirty(boolean dirty) Marks the bean as dirty.voidSet the dirty state on the bean.voidsetDisableLazyLoad(boolean disableLazyLoad) Set true to turn off lazy loading.voidsetEmbeddedDirty(int embeddedProperty) Called by an embedded bean onto its owner.voidsetEmbeddedLoaded(Object embeddedBean) Set the loaded status for the embedded bean.voidsetEmbeddedOwner(EntityBean parentBean, int embeddedOwnerIndex) Set the embedded beans owning bean.voidsetEmbeddedPropertyDirty(int propertyIndex) Set that an embedded bean has had one of its properties changed.voidsetForceUpdate(boolean forceUpdate) Set the bean to be updated when persisted (for merge).final voidsetFullyLoadedBean(boolean fullyLoadedBean) Set true when the bean is fully loaded (not a partial).voidsetLazyLoadFailure(Object ownerId) Set lazy load failure flag.voidSet the loaded state to true.voidsetLoadedFromCache(boolean loadedFromCache) Set true when the bean has been loaded from L2 bean cache.voidWhen finished loading for lazy or refresh on an already partially populated bean.voidsetLoadedProperty(int propertyIndex) Set the property to be loaded.voidSet all properties to be loaded (post insert).voidsetLoadError(int propertyIndex, Exception t) Set the load error that happened on this property.voidsetNew()Set the bean into NEW state.voidFor forced update on a 'New' bean set all the loaded properties to changed.voidsetNodeUsageCollector(NodeUsageCollector usageCollector) Turn on profile collection.voidsetOldValue(int propertyIndex, Object oldValue) Explicitly set an old value with force (the old value is forced even it is already set).voidsetOriginalValue(int propertyIndex, Object value) Set the original value for the property.voidsetOriginalValueForce(int propertyIndex, Object value) Set old value but force it to be set regardless if it already has a value.voidsetOwnerId(Object ownerId) Set the ownerId (IdClass).voidsetPersistenceContext(PersistenceContext persistenceContext) Set the persistenceContext.voidsetPropertyLoaded(String propertyName, boolean loaded) Set the loaded state of the property given it's name.voidsetPropertyUnloaded(int propertyIndex) Set the property to be treated as unloaded.voidsetReference(int idPos) Set this as a reference object.voidsetSortOrder(int sortOrder) Set the sort order value for an order column.intReturn the sort order value for an order column.toString()
-
Constructor Details
-
InterceptReadOnly
Create with a given entity.
-
-
Method Details
-
freeze
public boolean freeze()Description copied from interface:EntityBeanInterceptReturn true if this entity bean should be frozen. Used to handle recursive freezing. -
toString
-
persistenceContext
Description copied from interface:EntityBeanInterceptReturn the persistenceContext. -
setPersistenceContext
Description copied from interface:EntityBeanInterceptSet the persistenceContext. -
setNodeUsageCollector
Description copied from interface:EntityBeanInterceptTurn on profile collection. -
ownerId
Description copied from interface:EntityBeanInterceptReturn the ownerId (IdClass). -
setOwnerId
Description copied from interface:EntityBeanInterceptSet the ownerId (IdClass). -
embeddedOwner
Description copied from interface:EntityBeanInterceptReturn the owning bean for an embedded bean. -
embeddedOwnerIndex
public int embeddedOwnerIndex()Description copied from interface:EntityBeanInterceptReturn the property index (for the parent) of this embedded bean. -
clearGetterCallback
public void clearGetterCallback()Description copied from interface:EntityBeanInterceptClear the getter callback. -
registerGetterCallback
Description copied from interface:EntityBeanInterceptRegister the callback to be triggered when getter is called. This is used primarily to automatically flush the JDBC batch. -
setEmbeddedOwner
Description copied from interface:EntityBeanInterceptSet the embedded beans owning bean. -
setBeanLoader
Description copied from interface:EntityBeanInterceptSet the BeanLoader with PersistenceContext. -
setBeanLoader
Description copied from interface:EntityBeanInterceptSet the BeanLoader. -
isPartial
public boolean isPartial()Description copied from interface:EntityBeanInterceptReturn true if the bean is partially loaded. -
isDirty
public boolean isDirty()Description copied from interface:EntityBeanInterceptReturn true if this bean has been directly modified (it has oldValues) or if any embedded beans are either new or dirty (and hence need saving). -
setEmbeddedDirty
public void setEmbeddedDirty(int embeddedProperty) Description copied from interface:EntityBeanInterceptCalled by an embedded bean onto its owner. -
setDirty
public void setDirty(boolean dirty) Description copied from interface:EntityBeanInterceptMarks the bean as dirty. -
isNew
public boolean isNew()Description copied from interface:EntityBeanInterceptReturn true if this entity bean is new and not yet saved. -
isNewOrDirty
public boolean isNewOrDirty()Description copied from interface:EntityBeanInterceptReturn true if the entity bean is new or dirty (and should be saved). -
hasIdOnly
public boolean hasIdOnly(int idIndex) Description copied from interface:EntityBeanInterceptReturn true if only the Id property has been loaded. -
isReference
public boolean isReference()Description copied from interface:EntityBeanInterceptReturn true if the entity is a reference. -
setReference
public void setReference(int idPos) Description copied from interface:EntityBeanInterceptSet this as a reference object. -
setLoadedFromCache
public void setLoadedFromCache(boolean loadedFromCache) Description copied from interface:EntityBeanInterceptSet true when the bean has been loaded from L2 bean cache. The effect of this is that we should skip the cache if there is subsequent lazy loading (bean cache partially populated). -
isLoadedFromCache
public boolean isLoadedFromCache()Description copied from interface:EntityBeanInterceptReturn true if this bean was loaded from L2 bean cache. -
setForceUpdate
public void setForceUpdate(boolean forceUpdate) Description copied from interface:EntityBeanInterceptSet the bean to be updated when persisted (for merge). -
isUpdate
public boolean isUpdate()Description copied from interface:EntityBeanInterceptReturn true if the entity should be updated. -
isLoaded
public boolean isLoaded()Description copied from interface:EntityBeanInterceptReturn true if the entity has been loaded. -
setNew
public void setNew()Description copied from interface:EntityBeanInterceptSet the bean into NEW state. -
setLoaded
public void setLoaded()Description copied from interface:EntityBeanInterceptSet the loaded state to true.Calls to setter methods after the bean is loaded can result in 'Old Values' being created.
Worth noting that this is also set after a insert/update. By doing so it 'resets' the bean for making further changes and saving again.
-
setLoadedLazy
public void setLoadedLazy()Description copied from interface:EntityBeanInterceptWhen finished loading for lazy or refresh on an already partially populated bean. -
setLazyLoadFailure
Description copied from interface:EntityBeanInterceptSet lazy load failure flag. -
isLazyLoadFailure
public boolean isLazyLoadFailure()Description copied from interface:EntityBeanInterceptReturn true if the bean is marked as having failed lazy loading. -
isDisableLazyLoad
public boolean isDisableLazyLoad()Description copied from interface:EntityBeanInterceptReturn true if lazy loading is disabled. -
setDisableLazyLoad
public void setDisableLazyLoad(boolean disableLazyLoad) Description copied from interface:EntityBeanInterceptSet true to turn off lazy loading. -
setEmbeddedLoaded
Description copied from interface:EntityBeanInterceptSet the loaded status for the embedded bean. -
isEmbeddedNewOrDirty
Description copied from interface:EntityBeanInterceptReturn true if the embedded bean is new or dirty and hence needs saving. -
origValue
Description copied from interface:EntityBeanInterceptReturn the original value that was changed via an update. -
propertyLength
public int propertyLength()Description copied from interface:EntityBeanInterceptReturn the number of properties. -
setPropertyLoaded
Description copied from interface:EntityBeanInterceptSet the loaded state of the property given it's name. -
setPropertyUnloaded
public void setPropertyUnloaded(int propertyIndex) Description copied from interface:EntityBeanInterceptSet the property to be treated as unloaded. Used for properties initialised in default constructor. -
setLoadedProperty
public void setLoadedProperty(int propertyIndex) Description copied from interface:EntityBeanInterceptSet the property to be loaded. -
setLoadedPropertyAll
public void setLoadedPropertyAll()Description copied from interface:EntityBeanInterceptSet all properties to be loaded (post insert). -
isLoadedProperty
public boolean isLoadedProperty(int propertyIndex) Description copied from interface:EntityBeanInterceptReturn true if the property is loaded. -
isChangedProperty
public boolean isChangedProperty(int propertyIndex) Description copied from interface:EntityBeanInterceptReturn true if the property is considered changed. -
isDirtyProperty
public boolean isDirtyProperty(int propertyIndex) Description copied from interface:EntityBeanInterceptReturn true if the property was changed or if it is embedded and one of its embedded properties is dirty. -
markPropertyAsChanged
public void markPropertyAsChanged(int propertyIndex) Description copied from interface:EntityBeanInterceptExplicitly mark a property as having been changed. -
setChangedProperty
public void setChangedProperty(int propertyIndex) Description copied from interface:EntityBeanInterceptSet the changed state for the given property. -
setChangeLoaded
public void setChangeLoaded(int propertyIndex) Description copied from interface:EntityBeanInterceptSet the changed and loaded state for the given property. -
setEmbeddedPropertyDirty
public void setEmbeddedPropertyDirty(int propertyIndex) Description copied from interface:EntityBeanInterceptSet that an embedded bean has had one of its properties changed. -
setOriginalValue
Description copied from interface:EntityBeanInterceptSet the original value for the property. -
setOriginalValueForce
Description copied from interface:EntityBeanInterceptSet old value but force it to be set regardless if it already has a value. -
setNewBeanForUpdate
public void setNewBeanForUpdate()Description copied from interface:EntityBeanInterceptFor forced update on a 'New' bean set all the loaded properties to changed. -
loadedPropertyNames
Description copied from interface:EntityBeanInterceptReturn the set of property names for a partially loaded bean. -
dirtyProperties
public boolean[] dirtyProperties()Description copied from interface:EntityBeanInterceptReturn the array of flags indicating the dirty properties. -
dirtyPropertyNames
Description copied from interface:EntityBeanInterceptReturn the set of dirty properties. -
addDirtyPropertyNames
Description copied from interface:EntityBeanInterceptRecursively add dirty properties. -
hasDirtyProperty
Description copied from interface:EntityBeanInterceptReturn true if any of the given property names are dirty. -
dirtyValues
Description copied from interface:EntityBeanInterceptReturn a map of dirty properties with their new and old values. -
addDirtyPropertyValues
Description copied from interface:EntityBeanInterceptRecursively add dirty properties. -
addDirtyPropertyValues
Description copied from interface:EntityBeanInterceptRecursively add dirty properties. -
dirtyPropertyKey
Description copied from interface:EntityBeanInterceptReturn a dirty property hash taking into account embedded beans. -
addDirtyPropertyKey
Description copied from interface:EntityBeanInterceptAdd and return a dirty property hash. -
loaded
public boolean[] loaded()Description copied from interface:EntityBeanInterceptReturn the loaded state for all the properties. -
lazyLoadPropertyIndex
public int lazyLoadPropertyIndex()Description copied from interface:EntityBeanInterceptReturn the index of the property that triggered the lazy load. -
lazyLoadProperty
Description copied from interface:EntityBeanInterceptReturn the property that triggered the lazy load. -
loadBean
public void loadBean(int loadProperty) Description copied from interface:EntityBeanInterceptLoad the bean when it is a reference. -
loadBeanInternal
Description copied from interface:EntityBeanInterceptInvoke the lazy loading. This method is synchronised externally. -
initialisedMany
public void initialisedMany(int propertyIndex) Description copied from interface:EntityBeanInterceptCalled when a BeanCollection is initialised automatically. -
preGetterCallback
public void preGetterCallback(int propertyIndex) Description copied from interface:EntityBeanInterceptInvoke the PreGetterCallback if it has been set due to getter for the given property. -
preGetId
public void preGetId()Description copied from interface:EntityBeanInterceptCalled prior to Id property getter. -
preGetter
public void preGetter(int propertyIndex) Description copied from interface:EntityBeanInterceptMethod that is called prior to a getter method on the actual entity. -
preSetterMany
public void preSetterMany(boolean interceptField, int propertyIndex, Object oldValue, Object newValue) Description copied from interface:EntityBeanInterceptOneToMany and ManyToMany only set loaded state. -
setChangedPropertyValue
Description copied from interface:EntityBeanInterceptSet the property changed state, bean dirtyState and property original value. -
setDirtyStatus
public void setDirtyStatus()Description copied from interface:EntityBeanInterceptSet the dirty state on the bean. -
preSetter
Description copied from interface:EntityBeanInterceptCheck to see if the values are not equal. If they are not equal then create the old values for use with ConcurrencyMode.ALL. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, boolean oldValue, boolean newValue) Description copied from interface:EntityBeanInterceptCheck for primitive boolean. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, int oldValue, int newValue) Description copied from interface:EntityBeanInterceptCheck for primitive int. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, long oldValue, long newValue) Description copied from interface:EntityBeanInterceptCheck for primitive long. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, double oldValue, double newValue) Description copied from interface:EntityBeanInterceptCheck for primitive double. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, float oldValue, float newValue) Description copied from interface:EntityBeanInterceptCheck for primitive float. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, short oldValue, short newValue) Description copied from interface:EntityBeanInterceptCheck for primitive short. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, char oldValue, char newValue) Description copied from interface:EntityBeanInterceptCheck for primitive char. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, byte oldValue, byte newValue) Description copied from interface:EntityBeanInterceptCheck for primitive byte. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, char[] oldValue, char[] newValue) Description copied from interface:EntityBeanInterceptCheck for primitive char array. -
preSetter
public void preSetter(boolean intercept, int propertyIndex, byte[] oldValue, byte[] newValue) Description copied from interface:EntityBeanInterceptCheck for primitive byte array. -
setOldValue
Description copied from interface:EntityBeanInterceptExplicitly set an old value with force (the old value is forced even it is already set). -
sortOrder
public int sortOrder()Description copied from interface:EntityBeanInterceptReturn the sort order value for an order column. -
setSortOrder
public void setSortOrder(int sortOrder) Description copied from interface:EntityBeanInterceptSet the sort order value for an order column. -
setDeletedFromCollection
public void setDeletedFromCollection(boolean deletedFromCollection) Description copied from interface:EntityBeanInterceptSet if the entity was deleted from a BeanCollection. -
isOrphanDelete
public boolean isOrphanDelete()Description copied from interface:EntityBeanInterceptReturn true if the bean was orphan deleted from a collection. -
setLoadError
Description copied from interface:EntityBeanInterceptSet the load error that happened on this property. -
loadErrors
Description copied from interface:EntityBeanInterceptReturns the loadErrors. -
isChangedProp
public boolean isChangedProp(int i) Description copied from interface:EntityBeanInterceptReturn true if the property has its changed state set. -
mutableInfo
Description copied from interface:EntityBeanInterceptReturn the MutableValueInfo for the given property or null. -
mutableInfo
Description copied from interface:EntityBeanInterceptSet the MutableValueInfo for the given property. -
mutableNext
Description copied from interface:EntityBeanInterceptDirty detection set the next mutable property content and info .Set here as the mutable property dirty detection is based on json content comparison. We only want to perform the json serialisation once so storing it here as part of dirty detection so that we can get it back to bind in insert or update etc.
-
mutableNext
Description copied from interface:EntityBeanInterceptUpdate the 'next' mutable info returning the content that was obtained via dirty detection. -
owner
Description copied from interface:EntityBeanInterceptReturn the 'owning' entity bean.- Specified by:
ownerin interfaceEntityBeanIntercept
-
isFullyLoadedBean
public final boolean isFullyLoadedBean()Description copied from interface:EntityBeanInterceptReturn true if the bean is fully loaded (not a partial).- Specified by:
isFullyLoadedBeanin interfaceEntityBeanIntercept
-
setFullyLoadedBean
public final void setFullyLoadedBean(boolean fullyLoadedBean) Description copied from interface:EntityBeanInterceptSet true when the bean is fully loaded (not a partial).- Specified by:
setFullyLoadedBeanin interfaceEntityBeanIntercept
-
property
Description copied from interface:EntityBeanInterceptReturn the property name for the given property.- Specified by:
propertyin interfaceEntityBeanIntercept
-
findProperty
Description copied from interface:EntityBeanInterceptFinds the index position of a given property. Returns -1 if the property can not be found.- Specified by:
findPropertyin interfaceEntityBeanIntercept
-
loadedPropertyKey
Description copied from interface:EntityBeanInterceptReturn a loaded property hash.- Specified by:
loadedPropertyKeyin interfaceEntityBeanIntercept
-