Package org.simpleframework.xml.core
Class Caller
java.lang.Object
org.simpleframework.xml.core.Caller
The
Caller
acts as a means for the schema to invoke
the callback methods on an object. This ensures that the correct
method is invoked within the schema class. If the annotated method
accepts a map then this will provide that map to the method. This
also ensures that if specific annotation is not present in the
class that no action is taken on a persister callback.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Function
This is the pointer to the schema class commit function.private final Function
This is the pointer to the schema class complete function.private final Context
This is the context that is used to invoke the functions.private final Function
This is the pointer to the schema class persist function.private final Function
This is the pointer to the schema class replace function.private final Function
This is the pointer to the schema class resolve function.private final Function
This is the pointer to the schema class validation function. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is used to invoke the provided objects commit function during the deserialization process.void
This method is used to invoke the provided objects completion function.void
This method is used to invoke the provided objects persistence function.This is used to replace the deserialized object with another instance, perhaps of a different type.This is used to replace the deserialized object with another instance, perhaps of a different type.void
This method is used to invoke the provided objects validation function during the deserialization process.
-
Field Details
-
commit
This is the pointer to the schema class commit function. -
validate
This is the pointer to the schema class validation function. -
persist
This is the pointer to the schema class persist function. -
complete
This is the pointer to the schema class complete function. -
replace
This is the pointer to the schema class replace function. -
resolve
This is the pointer to the schema class resolve function. -
context
This is the context that is used to invoke the functions.
-
-
Constructor Details
-
Caller
Constructor for theCaller
object. This is used to wrap the schema class such that callbacks from the persister can be dealt with in a seamless manner. This ensures that the correct function and arguments are provided to the functions. element and attribute XML annotations scanned from- Parameters:
schema
- this is the scanner that contains the functionscontext
- this is the context used to acquire the session
-
-
Method Details
-
replace
This is used to replace the deserialized object with another instance, perhaps of a different type. This is useful when an XML schema class acts as a reference to another XML document which needs to be loaded externally to create an object of a different type.- Parameters:
source
- the source object to invoke the function on- Returns:
- this returns the object that acts as the replacement
- Throws:
Exception
- if the replacement function cannot complete
-
resolve
This is used to replace the deserialized object with another instance, perhaps of a different type. This is useful when an XML schema class acts as a reference to another XML document which needs to be loaded externally to create an object of a different type.- Parameters:
source
- the source object to invoke the function on- Returns:
- this returns the object that acts as the replacement
- Throws:
Exception
- if the replacement function cannot complete
-
commit
This method is used to invoke the provided objects commit function during the deserialization process. The commit function must be marked with theCommit
annotation so that when the object is deserialized the persister has a chance to invoke the function so that the object can build further data structures.- Parameters:
source
- this is the object that has just been deserialized- Throws:
Exception
- thrown if the commit process cannot complete
-
validate
This method is used to invoke the provided objects validation function during the deserialization process. The validation function must be marked with theValidate
annotation so that when the object is deserialized the persister has a chance to invoke that function so that object can validate its field values.- Parameters:
source
- this is the object that has just been deserialized- Throws:
Exception
- thrown if the validation process failed
-
persist
This method is used to invoke the provided objects persistence function. This is invoked during the serialization process to get the object a chance to perform an necessary preparation before the serialization of the object proceeds. The persist function must be marked with thePersist
annotation.- Parameters:
source
- the object that is about to be serialized- Throws:
Exception
- thrown if the object cannot be persisted
-
complete
This method is used to invoke the provided objects completion function. This is invoked after the serialization process has completed and gives the object a chance to restore its state if the persist function required some alteration or locking. This is marked with theComplete
annotation.- Parameters:
source
- this is the object that has been serialized- Throws:
Exception
- thrown if the object cannot complete
-