Interface ExternalizableLite
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractAggregator
,AbstractBigDecimalAggregator
,AbstractCoherenceBasedCompleteConfiguration
,AbstractComparableAggregator
,AbstractCompositeExtractor
,AbstractDoubleAggregator
,AbstractLongAggregator
,AbstractPofPath
,AbstractPriorityTask
,AbstractScript
,AllFilter
,AlwaysFilter
,AndFilter
,AnyFilter
,ArrayFilter
,Atomics.SerializableAtomicMarkableReference
,Atomics.SerializableAtomicStampedReference
,BetweenFilter
,BigDecimalAverage
,BigDecimalMax
,BigDecimalMin
,BigDecimalSum
,Binary
,CacheEventFilter
,ChainedComparator
,ChainedExtractor
,ChainedFragmentExtractor
,ChainedParameterResolver
,CoherenceEntryProcessorResult
,ComparableMax
,ComparableMin
,ComparisonFilter
,ComparisonValueExtractor
,CompositeAggregator
,CompositeAggregator.Parallel
,CompositeKey
,CompositeProcessor
,CompositeUpdater
,ConditionalExtractor
,ConditionalProcessor
,ConditionalPut
,ConditionalPutAll
,ConditionalRemove
,ContainsAllFilter
,ContainsAnyFilter
,ContainsFilter
,ContextJCacheStatistics
,Count
,DefaultVersionedPartitions
,DeserializationAccelerator
,DistinctValues
,DoubleAverage
,DoubleMax
,DoubleMin
,DoubleSum
,EntryComparator
,EntryExtractor
,EqualsFilter
,EvolvableHolder
,ExtractorComparator
,ExtractorEventTransformer
,ExtractorFilter
,ExtractorProcessor
,FilterTrigger
,Fragment
,FragmentExtractor
,GreaterEqualsFilter
,GreaterFilter
,GroupAggregator
,GroupAggregator.Parallel
,IdentityExtractor
,ImmutableArrayList
,InFilter
,InKeySetFilter
,InstanceBuilder
,InverseComparator
,IsNotNullFilter
,IsNullFilter
,JCacheEntryMetaInf
,JCacheIdentifier
,JsonMap
,KeyAssociatedFilter
,KeyExtractor
,LessEqualsFilter
,LessFilter
,LikeFilter
,LimitFilter
,LiteMap
,LiteralExpression
,LiteSet
,LocalCacheAsynchronousMapListener.NonSyntheticEntryFilter
,LocalCacheConfiguration
,LockOwner
,LongMax
,LongMin
,LongSum
,MapEventFilter
,MapEventTransformerFilter
,MapSet
,MethodInvocationProcessor
,MultiExtractor
,NeverFilter
,NonSyntheticEntryFilter
,NotEqualsFilter
,NotFilter
,NullFilter
,NullImplementation.NullEntryProcessor
,NullImplementation.NullMap
,NullImplementation.NullObservableMap
,NullImplementation.NullSet
,NullImplementation.NullValueExtractor
,NullParameterResolver
,NumberIncrementor
,NumberMultiplier
,OrFilter
,Ownership
,Parameter
,ParameterMacroExpression
,PartitionedCacheAsynchronousMapListener.NonSyntheticEntryFilter
,PartitionedCacheConfiguration
,PartitionedFilter
,PartitionedJCacheStatistics.CacheStatisticsExtractor
,PartitionedJCacheStatistics.PartitionedCacheStatisticsAggregator
,PartitionedJCacheStatistics.PartitionedCacheStatisticsClear
,PartitionSet
,PartitionStatistics
,PassThroughFilterAdapter
,PermitAcquirer
,PredicateFilter
,PreloadRequest
,PresentFilter
,PriorityAggregator
,PriorityFilter
,PriorityProcessor
,PropertyManipulator
,PropertyProcessor
,PropertySet
,Publisher.FailOnFull
,Publisher.OrderBy
,Publisher.OrderById
,Publisher.OrderByNone
,Publisher.OrderByRoundRobin
,Publisher.OrderByThread
,Publisher.OrderByValue
,QueryRecorder
,ReducerAggregator
,ReflectionExtractor
,ReflectionUpdater
,RegexFilter
,RemoteCacheConfiguration
,ResolvableParameterList
,SafeComparator
,SafeHashSet
,SamplingEventTransformer
,ScopedParameterResolver
,ScriptAggregator
,ScriptFilter
,ScriptProcessor
,ScriptValueExtractor
,SegmentedHashSet
,SemiLiteEventTransformer
,SimpleDocument
,SimpleElement
,SimpleElement.AttributeMap
,SimpleElement.ElementList
,SimpleHolder
,SimpleParameterList
,SimplePartitionKey
,SimplePofPath
,SimpleQueryRecord
,SimpleQueryRecord.PartialResult
,SimpleQueryRecord.PartialResult.AbstractRecordableStep
,SimpleQueryRecord.PartialResult.ExplainStep
,SimpleQueryRecord.PartialResult.IndexLookupRecord
,SimpleQueryRecord.PartialResult.Step
,SimpleQueryRecord.PartialResult.TraceStep
,SimpleValue
,StaticContent
,StaticFactoryInstanceBuilder
,Subscriber.CommitResult
,Subscriber.CompleteOnEmpty
,Subscriber.Convert
,Subscriber.Filtered
,Subscriber.Name
,TopNAggregator
,TopNAggregator.PartialResult
,TouchProcessor
,UID
,UniversalExtractor
,UniversalManipulator
,UniversalUpdater
,UpdaterProcessor
,UUID
,ValueChangeEventFilter
,ValueMacroExpression
,VersionedOwnership
,VersionedPut
,VersionedPutAll
,XmlBean
,XorFilter
The readExternal and writeExternal methods of the ExternalizableLite
interface are implemented by a class to give the class complete
control over the format and contents of the stream for an object. Unlike
the Externalizable
interface, these methods operate on more
primitive DataInput and DataOutput streams, allowing for significantly
better performance, but often requiring more effort to implement.
These methods must explicitly coordinate with the supertype to save its state. When an ExternalizableLite object is reconstructed, an instance is created using the public no-arg constructor, then the readExternal method called. Therefore, in addition to the methods listed below, a public default constructor is required.
Since a graph traversal is not managed by the stream, only uni-directional object graphs (e.g. object trees) can be serialized using this approach.
Note: it is extremely important that objects that are equivalent according to their "equals()" implementation produce equivalent serialized streams. Violating this relationship will result in non-deterministic behavior for many Coherence services.
Here is an example of how to write a custom ExternalizableLite deserialization method that incorporates calling a constructor to set members that do not have a setter.
public class NotAPojo { public NotAPojo(int field) {this.field = field;} public int getField() {return field;} private int field; }
@ExternalizableType(serializer = Serializer.class)
public class NotAPojoSerializable extends NotAPojo implements ExternalizableLite {
public NotAPojoSerializable(int field) { super(field); }
static public class Serializer implements ExternalizableLiteSerializer {
public T deserialize(DataInput in) throws IOException {
return new NotAPojoSerializable(in.readInt());
}
public void serialize(DataOutput out,T value) throws IOException {
out.writeInt(value.getField());
}
}
- Since:
- Coherence 2.1
- Author:
- gg 2003.02.08
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Restore the contents of this object by loading the object's state from the passed DataInput object.default void
writeExternal
(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.
-
Method Details
-
readExternal
Restore the contents of this object by loading the object's state from the passed DataInput object.- Parameters:
in
- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException
- if an I/O exception occursNotActiveException
- if the object is not in its initial state, and therefore cannot be deserialized into
-
writeExternal
Save the contents of this object by storing the object's state into the passed DataOutput object.- Parameters:
out
- the DataOutput stream to write the state of this object to- Throws:
IOException
- if an I/O exception occurs
-