Class OObjectEntitySerializer
java.lang.Object
com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer
- Author:
- Luca Molino (molino.luca--at--gmail.com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddCascadeDeleteField(Class<?> currentClass, String fieldName) protected static voidaddFetchLazyField(Class<?> currentClass, String fieldName) static <T> Tattach(T o, ODatabaseObject db) Method that attaches all data contained in the object to the associated documentprotected static booleancheckCascadeAnnotationAttribute(javax.persistence.CascadeType[] cascadeList) protected static booleancheckCascadeDelete(javax.persistence.ManyToMany manyToMany) protected static booleancheckCascadeDelete(javax.persistence.OneToMany oneToMany) protected static booleancheckCascadeDelete(javax.persistence.OneToOne oneToOne) protected static voidcheckClassRegistration(Class<?> iClass) protected static booleancheckFetchLazy(javax.persistence.OneToOne oneToOne) static voidderegisterClass(Class<?> iClass) static ObjectdeserializeFieldValue(Class<?> type, Object iFieldValue) static <T> Tdetach(T o, ODatabaseObject db) Method that detaches all fields contained in the document to the given object.static <T> Tdetach(T o, ODatabaseObject db, boolean returnNonProxiedInstance) Method that detaches all fields contained in the document to the g(e non fare al solitiven object.static <T> TdetachAll(T o, ODatabaseObject db, boolean returnNonProxiedInstance, Map<Object, Object> alreadyDetached, Map<Object, Object> lazyObjects) Method that detaches all fields contained in the document to the given object and recursively all object tree.static Class<?>getBoundClassTarget(Class<?> type) static FieldgetBoundedDocumentField(Class<?> iClass) getCallbackMethods(Class<?> iAnnotation, Class<?> iClass) getCascadeDeleteFields(Class<?> iClass) getCascadeDeleteFields(String iClassName) getClassFields(Class<?> iClass) protected static OObjectEntitySerializer.OObjectEntitySerializedSchemastatic Annotation[]getDeclaredAnnotations(Class<?> clazz) Retrieves and returns all declaredFields from the given class.static Field[]getDeclaredFields(Class<?> clazz) Retrieves and returns all declaredFields from the given class.static ODocumentgetDocument(javassist.util.proxy.Proxy proxiedObject) Method that given a proxied entity returns the associated ODocumentstatic Class<?>getEnclosingClass(Class<?> clazz) static Fieldstatic ObjectgetFieldValue(Field iField, Object iInstance) static FieldgetIdField(Class<?> iClass) static <T> TgetNonProxiedInstance(T iObject) static ORIDgetRid(javassist.util.proxy.Proxy proxiedObject) Method that given a proxied entity returns the associated ODocument RIDstatic Class<?>getSerializedType(Field iField) static Class<?>static Class<?>static OTypegetTypeByClass(Class<?> iClass, String fieldName) static OTypegetTypeByClass(Class<?> iClass, String fieldName, Field f) static intgetVersion(javassist.util.proxy.Proxy proxiedObject) Method that given a proxied entity returns the associated ODocument versionstatic FieldgetVersionField(Class<?> iClass) static booleanhasBoundedDocumentField(Class<?> iClass) static voidinvokeAfterDeserializationCallbacks(Class<?> iClass, Object iInstance, ODocument iDocument) static voidinvokeAfterSerializationCallbacks(Class<?> iClass, Object iInstance, ODocument iDocument) static voidinvokeBeforeDeserializationCallbacks(Class<?> iClass, Object iInstance, ODocument iDocument) static voidinvokeBeforeSerializationCallbacks(Class<?> iClass, Object iInstance, ODocument iDocument) protected static voidinvokeCallback(Class<?> iClass, Object iPojo, ODocument iDocument, Class<?> iAnnotation) protected static voidinvokeCallback(Object iPojo, ODocument iDocument, Class<?> iAnnotation) static booleanisCascadeDeleteField(Class<?> iClass, String iField) static booleanisClassField(Class<?> iClass, String iField) static booleanisEmbeddedField(Class<?> iClass, String iField) static booleanisFetchLazyField(Class<?> iClass, String iField) static booleanstatic booleanstatic booleanisSerializedType(Field iField) static booleanisToSerialize(Class<?> type) static booleanisTransientField(Class<?> iClass, String iField) static booleanisVersionField(Class<?> iClass, String iFieldName) static voidregisterClass(Class<?> iClass) static voidregisterClass(Class<?> iClass, boolean forceReload) Registers the class informations that will be used in serialization, deserialization and lazy loading of it.static ObjectserializeFieldValue(Class<?> type, Object iFieldValue) static <T> TserializeObject(T o, ODatabaseObject db) Method that given an object serialize it an creates a proxy entity, in case the object isn't generated using the ODatabaseObject.newInstance()static voidsetFieldValue(Field iField, Object iInstance, Object iValue) static voidsetIdField(Class<?> iClass, Object iObject, ORID iValue) static voidsetVersionField(Class<?> iClass, Object iObject, int iValue) static voidprotected static <T> TtoStream(T iPojo, javassist.util.proxy.Proxy iProxiedPojo, ODatabaseObject db) Serialize the user POJO to a ORecordDocument instance.static ObjecttypeToStream(Object iFieldValue, OType iType, ODatabaseObject db, ODocument iRecord)
-
Field Details
-
SIMPLE_NAME
-
-
Constructor Details
-
OObjectEntitySerializer
public OObjectEntitySerializer()
-
-
Method Details
-
getCurrentSerializedSchema
-
serializeObject
Method that given an object serialize it an creates a proxy entity, in case the object isn't generated using the ODatabaseObject.newInstance()- Parameters:
o- - the object to serialize- Returns:
- the proxied object
-
attach
Method that attaches all data contained in the object to the associated document- Type Parameters:
T-- Parameters:
o- :- the object to attachdb- :- the database instance- Returns:
- the object serialized or with attached data
-
detach
Method that detaches all fields contained in the document to the given object. It returns by default a proxied instance. To get a detached non proxied instance @seeOObjectEntitySerializer#detach(T o, ODatabaseObject db, boolean returnNonProxiedInstance)- Type Parameters:
T-- Parameters:
o- :- the object to detachdb- :- the database instance- Returns:
- proxied instance: the object serialized or with detached data
-
detach
Method that detaches all fields contained in the document to the g(e non fare al solitiven object.- Type Parameters:
T-- Parameters:
o- :- the object to detachdb- :- the database instancereturnNonProxiedInstance- :- defines if the return object will be a proxied instance or not. If set to TRUE and the object does not contains @Id and @Version fields it could procude data replication- Returns:
- the object serialized or with detached data
-
detachAll
public static <T> T detachAll(T o, ODatabaseObject db, boolean returnNonProxiedInstance, Map<Object, Object> alreadyDetached, Map<Object, Object> lazyObjects) Method that detaches all fields contained in the document to the given object and recursively all object tree. This may throw aStackOverflowErrorwith big objects tree. To avoid it set the stack size with -Xss java option- Type Parameters:
T-- Parameters:
o- :- the object to detachdb- :- the database instancereturnNonProxiedInstance- :- defines if the return object will be a proxied instance or not. If set to TRUE and the object does not contains @Id and @Version fields it could procude data replication- Returns:
- the object serialized or with detached data
-
getDocument
Method that given a proxied entity returns the associated ODocument- Parameters:
proxiedObject- - the proxied entity object- Returns:
- The ODocument associated with the object
-
getRid
Method that given a proxied entity returns the associated ODocument RID- Parameters:
proxiedObject- - the proxied entity object- Returns:
- The ORID of associated ODocument
-
getVersion
public static int getVersion(javassist.util.proxy.Proxy proxiedObject) Method that given a proxied entity returns the associated ODocument version- Parameters:
proxiedObject- - the proxied entity object- Returns:
- The version of associated ODocument
-
isClassField
-
isTransientField
-
getCascadeDeleteFields
-
getCascadeDeleteFields
-
isCascadeDeleteField
-
isFetchLazyField
-
isEmbeddedField
-
checkClassRegistration
-
registerClass
-
registerClass
Registers the class informations that will be used in serialization, deserialization and lazy loading of it. If already registered does nothing.- Parameters:
iClass- :- the Class<?> to registerforceReload- whether or not to force the reload of the schema before registering
-
deregisterClass
-
checkCascadeDelete
protected static boolean checkCascadeDelete(javax.persistence.OneToOne oneToOne) -
checkCascadeDelete
protected static boolean checkCascadeDelete(javax.persistence.OneToMany oneToMany) -
checkCascadeDelete
protected static boolean checkCascadeDelete(javax.persistence.ManyToMany manyToMany) -
checkCascadeAnnotationAttribute
protected static boolean checkCascadeAnnotationAttribute(javax.persistence.CascadeType[] cascadeList) -
checkFetchLazy
protected static boolean checkFetchLazy(javax.persistence.OneToOne oneToOne) -
addCascadeDeleteField
-
addFetchLazyField
-
isSerializedType
-
getSerializedType
-
isToSerialize
-
getBoundClassTarget
-
serializeFieldValue
-
deserializeFieldValue
-
typeToStream
public static Object typeToStream(Object iFieldValue, OType iType, ODatabaseObject db, ODocument iRecord) -
getClassFields
-
hasBoundedDocumentField
-
getBoundedDocumentField
-
isIdField
-
isIdField
-
getIdField
-
setIdField
public static void setIdField(Class<?> iClass, Object iObject, ORID iValue) throws IllegalArgumentException, IllegalAccessException -
isVersionField
-
getVersionField
-
setVersionField
public static void setVersionField(Class<?> iClass, Object iObject, int iValue) throws IllegalArgumentException, IllegalAccessException -
getFieldValue
public static Object getFieldValue(Field iField, Object iInstance) throws IllegalArgumentException, IllegalAccessException -
setFieldValue
public static void setFieldValue(Field iField, Object iInstance, Object iValue) throws IllegalArgumentException, IllegalAccessException -
invokeBeforeSerializationCallbacks
-
invokeAfterSerializationCallbacks
-
invokeAfterDeserializationCallbacks
-
invokeBeforeDeserializationCallbacks
-
getTypeByClass
-
getTypeByClass
-
getField
-
getSpecifiedMultiLinkedType
-
getSpecifiedLinkedType
-
getNonProxiedInstance
public static <T> T getNonProxiedInstance(T iObject) -
synchronizeSchema
public static void synchronizeSchema() -
toStream
protected static <T> T toStream(T iPojo, javassist.util.proxy.Proxy iProxiedPojo, ODatabaseObject db) throws IllegalArgumentException, IllegalAccessException Serialize the user POJO to a ORecordDocument instance.- Parameters:
iPojo- User pojo to serialize- Throws:
IllegalAccessExceptionIllegalArgumentException
-
invokeCallback
-
invokeCallback
-
getCallbackMethods
-
getDeclaredFields
Retrieves and returns all declaredFields from the given class.- Parameters:
clazz- The class type.- Returns:
- All declared
Fields for the object instance.
-
getDeclaredAnnotations
Retrieves and returns all declaredFields from the given class.- Parameters:
clazz- The class type.- Returns:
- All declared
Fields for the object instance.
-
getEnclosingClass
-