Package org.kingdoms.constants.base
Class CompressedSmartObject
java.lang.Object
org.kingdoms.constants.base.CompressedSmartObject
- All Implemented Interfaces:
SmartObject
- Direct Known Subclasses:
KingdomsObject
State priority:
OutputStreamExpiredObjectStateFORCE_SAVEALREADY_SETTING_META- Compressed meta
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.kingdoms.utils.internal.FastByteArrayOutputStreamprotected org.kingdoms.data.handlers.abstraction.DataHandler<?> Used for serialization of the smart object into a compressed state to determineshouldSave()final booleanfinal voidinvalidateObject(String reason) Mark this object as a phantom object.final booleanfinal booleanfinal voidsaveObjectState(boolean forceSave) Should be called after a data is either fully loaded from the database or loaded into the manager by other means.booleanShould this data be saved to the database?toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kingdoms.constants.base.SmartObject
isDataEmpty
-
Field Details
-
objectState
-
-
Constructor Details
-
CompressedSmartObject
public CompressedSmartObject()
-
-
Method Details
-
invalidateObject
Description copied from interface:SmartObjectMark this object as a phantom object. No reference should access this object, and it's expected to be garbage collected since it no longer exists in the cache. Implementations must try to guard most access to this object withSmartObject.ensureValidObject().- Specified by:
invalidateObjectin interfaceSmartObject- See Also:
-
isNewData
@Internal public final boolean isNewData() -
hasObjectExpired
public final boolean hasObjectExpired()- Specified by:
hasObjectExpiredin interfaceSmartObject- See Also:
-
ensureValidObject
public void ensureValidObject()- Specified by:
ensureValidObjectin interfaceSmartObject- See Also:
-
getDataHandler
protected org.kingdoms.data.handlers.abstraction.DataHandler<?> getDataHandler()Used for serialization of the smart object into a compressed state to determineshouldSave()- Throws:
UnsupportedOperationException- if this object is a part of another smart object that implements this method.
-
getCompressedData
@Contract(pure=true) public org.kingdoms.utils.internal.FastByteArrayOutputStream getCompressedData() -
saveObjectState
public final void saveObjectState(boolean forceSave) Description copied from interface:SmartObjectShould be called after a data is either fully loaded from the database or loaded into the manager by other means.- Specified by:
saveObjectStatein interfaceSmartObject- Parameters:
forceSave- true if this data should be saved regardless if it was changed or not. This is used when this data never existed in the database or certain operations that guarantee that the object will be changed. Using this can result in huge performance gain.- See Also:
-
isObjectStateSaved
public final boolean isObjectStateSaved()- Specified by:
isObjectStateSavedin interfaceSmartObject- See Also:
-
shouldSave
public boolean shouldSave()Description copied from interface:SmartObjectShould this data be saved to the database?- Specified by:
shouldSavein interfaceSmartObject
-
toString
-