|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.avaje.ebean.bean.EntityBeanIntercept
public final class EntityBeanIntercept
This is the object added to every entity bean using byte code enhancement.
This provides the mechanisms to support deferred fetching of reference beans and oldValues generation for concurrency checking.
Field Summary | |
---|---|
static int |
DEFAULT
The default state (CacheStrategy readOnly can be applied). |
static int |
READONLY
Bean is READ ONLY (not editable). |
static int |
SHARED
Read Only immutable state and can't be made editable (when in cache and sharable). |
static int |
UPDATE
Editable (used when the default results in a Read Only bean). |
Constructor Summary | |
---|---|
EntityBeanIntercept(Object owner)
Create a intercept with a given entity. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener for this entity bean. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a property change listener for this entity bean for a specific property. |
void |
copyStateTo(EntityBeanIntercept dest)
Copy the internal state of the intercept to another intercept. |
int |
getBeanLoaderIndex()
Return the index position for batch loading via BeanLoader. |
Set<String> |
getChangedProps()
Return the set of property names for changed properties. |
String |
getLazyLoadProperty()
Return the property read or write that triggered the lazy load. |
Set<String> |
getLoadedProps()
Return the set of property names for a partially loaded bean. |
Object |
getOldValues()
Return the old values used for ConcurrencyMode.ALL. |
EntityBean |
getOwner()
Return the 'owning' entity bean. |
Object |
getParentBean()
Return the parent bean (by relationship). |
PersistenceContext |
getPersistenceContext()
Return the persistenceContext. |
int |
getState()
Return the state of the bean (DEFAULT,UPDATE,READONLY,SHARED). |
boolean |
isDirty()
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). |
boolean |
isDisableLazyLoad()
Return true if lazy loading is disabled. |
boolean |
isEmbeddedNewOrDirty(Object embeddedBean)
Return true if the embedded bean is new or dirty and hence needs saving. |
boolean |
isIntercepting()
Return true if the bean currently has interception on. |
boolean |
isLoaded()
Return true if the entity has been loaded. |
boolean |
isNew()
Return true if this entity bean is new and not yet saved. |
boolean |
isNewOrDirty()
Return true if the entity bean is new or dirty (and should be saved). |
boolean |
isReadOnly()
Return true if the bean should be treated as readOnly. |
boolean |
isReference()
Return true if the entity is a reference. |
boolean |
isSharedInstance()
Return true if this is a shared instance. |
boolean |
isUseCache()
Return true if this bean should use the cache when lazy loading. |
void |
postSetter(PropertyChangeEvent event)
Called for "enhancement" postSetter processing. |
void |
postSetter(PropertyChangeEvent event,
Object newValue)
Called for "subclassed" postSetter processing. |
void |
preGetter(String propertyName)
Method that is called prior to a getter method on the actual entity. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
boolean oldValue,
boolean newValue)
Check for primitive boolean. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
byte[] oldValue,
byte[] newValue)
byte[]. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
byte oldValue,
byte newValue)
char. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
char[] oldValue,
char[] newValue)
char[]. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
char oldValue,
char newValue)
char. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
double oldValue,
double newValue)
double. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
float oldValue,
float newValue)
float. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
int oldValue,
int newValue)
Check for primitive int. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
long oldValue,
long newValue)
long. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
Object oldValue,
Object newValue)
Check to see if the values are not equal. |
PropertyChangeEvent |
preSetter(boolean intercept,
String propertyName,
short oldValue,
short newValue)
short. |
PropertyChangeEvent |
preSetterMany(boolean interceptField,
String propertyName,
Object oldValue,
Object newValue)
OneToMany and ManyToMany don't have any interception so just check for PropertyChangeSupport. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener for this entity bean. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a property change listener for this entity bean for a specific property. |
void |
setBeanLoader(int index,
BeanLoader ctx)
|
void |
setDisableLazyLoad(boolean disableLazyLoad)
Set true to turn off lazy loading. |
void |
setEmbeddedLoaded(Object embeddedBean)
Set the loaded status for the embedded bean. |
void |
setIntercepting(boolean intercepting)
Turn interception off or on. |
void |
setLoaded()
Set the loaded state to true. |
void |
setLoadedLazy()
When finished loading for lazy or refresh on an already partially populated bean. |
void |
setLoadedProps(Set<String> loadedPropertyNames)
Set the property names for a partially loaded bean. |
void |
setNodeUsageCollector(NodeUsageCollector usageCollector)
Turn on profile collection. |
void |
setParentBean(Object parentBean)
Special case for a OneToOne, Set the parent bean (by relationship). |
void |
setPersistenceContext(PersistenceContext persistenceContext)
Set the persistenceContext. |
void |
setReadOnly(boolean readOnly)
Set the readOnly status. |
void |
setReference()
Set this as a reference object. |
void |
setSharedInstance()
Set this called when it is known this is a shared instance. |
void |
setState(int parentState)
Set the state of the bean (DEFAULT,UPDATE,READONLY,SHARED). |
void |
setUseCache(boolean loadFromCache)
Set to true if this bean should use the cache when lazy loading. |
String |
toString()
|
Object |
writeReplaceIntercept()
This is ONLY used for subclass entity beans. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT
public static final int UPDATE
public static final int READONLY
public static final int SHARED
Constructor Detail |
---|
public EntityBeanIntercept(Object owner)
Refer to agent ProxyConstructor.
Method Detail |
---|
public void setState(int parentState)
Note that UPDATE is really only to force readOnly = false when the default cache setting has readOnly = true.
public int getState()
public void copyStateTo(EntityBeanIntercept dest)
public EntityBean getOwner()
public String toString()
toString
in class Object
public PersistenceContext getPersistenceContext()
public void setPersistenceContext(PersistenceContext persistenceContext)
public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void setNodeUsageCollector(NodeUsageCollector usageCollector)
public Object getParentBean()
public void setParentBean(Object parentBean)
public int getBeanLoaderIndex()
public void setBeanLoader(int index, BeanLoader ctx)
public boolean isDirty()
public boolean isNew()
public boolean isNewOrDirty()
public boolean isReference()
public void setReference()
public Object getOldValues()
public boolean isUseCache()
public void setUseCache(boolean loadFromCache)
public boolean isSharedInstance()
A shared instance must always be treated as read only.
public void setSharedInstance()
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public boolean isIntercepting()
With interception on the bean will invoke lazy loading and dirty checking.
public void setIntercepting(boolean intercepting)
This is to support custom serialisation mechanisms that just read all the properties on the bean.
public boolean isLoaded()
public void setLoaded()
Calls to setter methods after the bean is loaded can result in 'Old Values' being created to support ConcurrencyMode.ALL
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.
public void setLoadedLazy()
public boolean isDisableLazyLoad()
public void setDisableLazyLoad(boolean disableLazyLoad)
Typically used to disable lazy loading on SQL based report beans.
public void setEmbeddedLoaded(Object embeddedBean)
public boolean isEmbeddedNewOrDirty(Object embeddedBean)
public void setLoadedProps(Set<String> loadedPropertyNames)
loadedPropertyNames
- the names of the loaded propertiespublic Set<String> getLoadedProps()
public Set<String> getChangedProps()
public String getLazyLoadProperty()
public Object writeReplaceIntercept() throws ObjectStreamException
This is not used when entity bean classes are enhanced via javaagent or ant etc - only when a subclass is generated.
Returns a Serializable instance that is either the 'byte code generated' object or a 'Vanilla' copy of this bean depending on SerializeControl.isVanillaBeans().
ObjectStreamException
public void preGetter(String propertyName)
This checks if the bean is a reference and should be loaded.
public void postSetter(PropertyChangeEvent event)
public void postSetter(PropertyChangeEvent event, Object newValue)
public PropertyChangeEvent preSetterMany(boolean interceptField, String propertyName, Object oldValue, Object newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, Object oldValue, Object newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, boolean oldValue, boolean newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, int oldValue, int newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, long oldValue, long newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, double oldValue, double newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, float oldValue, float newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, short oldValue, short newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, char oldValue, char newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, byte oldValue, byte newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, char[] oldValue, char[] newValue)
public PropertyChangeEvent preSetter(boolean intercept, String propertyName, byte[] oldValue, byte[] newValue)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |