Class SerializedRecord
java.lang.Object
com.norconex.crawler.core.cluster.SerializedRecord
Backend-agnostic envelope for storing arbitrary objects as a pair of:
- className: fully qualified class name of the original object
- serialized: JSON representation of the original object
This type intentionally has no backend-specific annotations so it can be
used in any storage path (e.g., String caches, DB) and adapted by
backend-specific wrappers (e.g., Protostream-annotated classes).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()voidsetClassName(String className) voidsetSerialized(String serialized) toString()<T> Tunwrap()Reconstructs the original object instance using the stored className and JSON payload.static SerializedRecordCreates an envelope for the given object.
-
Constructor Details
-
SerializedRecord
-
SerializedRecord
public SerializedRecord()
-
-
Method Details
-
wrap
Creates an envelope for the given object.- Parameters:
object- object to wrap- Returns:
- serialized envelope
-
unwrap
public <T> T unwrap()Reconstructs the original object instance using the stored className and JSON payload. Returns null if the payload is null/empty. Throws CrawlerException if the class cannot be resolved.- Type Parameters:
T- the type of the returned object- Returns:
- the deserialized object
-
getClassName
-
getSerialized
-
setClassName
-
setSerialized
-
equals
-
hashCode
public int hashCode() -
toString
-