T
- the marshalled object's type.public abstract static class Marshaller.Typed<T> extends Marshaller<T>
Marshaller.forTypes
and Marshaller.forClasses
methods for multiple types, or using
Marshaller.forType
and Marshaller.forClass
for a single type.
The serial form of typed marshaller uses efficient serialization of primitive data
(individual and arrays) and single ObjectOutputStream
for remaining non-primitive data.
Unlike Marshaller.serialization(Class)
serialization} marshallers, typed marshallers for different
types are not the same and are not compatible on a byte-array level even if the actual serialized objects
are the same. The same exact marshaller shall be used for writing and for reading.
Marshaller.Typed<T>
SERIALIZATION
Modifier and Type | Method and Description |
---|---|
abstract boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
abstract Class<?>[] |
getClasses(ClassLoader cl)
Returns an array of classes of this typed marshaller.
|
abstract String |
getTypes()
Returns a comma-separated list of type names of this typed marshaller.
|
abstract int |
hashCode()
Returns a hash code value for the object that is consistent with
equals . |
forClass, forClasses, forType, forTypes, readMarshalledLength, readObjectFrom, representsNullObjectAsNullBytes, serialization, serialization, supportsNullObject, writeMarshalledLength, writeObjectTo
public abstract String getTypes()
Class.getName()
method.public abstract Class<?>[] getClasses(ClassLoader cl) throws InvalidClassException
ClassLoader
argument
is used only by the first successful invocation of this method. The resolved classes
are stored in the instance of this class afterwards.cl
- Classloader to resolve classes that were specified by their types names.InvalidClassException
- if classes cannot be found/loaded.public abstract boolean equals(Object obj)
types
are the same and
they were both produced by
Marshaller.forTypes
and
Marshaller.forClasses
or by
Marshaller.forType
and
Marshaller.forClass
methods.
Note, that comparison for equality does not check the equality of actual classes, so typed marshallers for different classes with the same name (from different class loaders) are considered to be equal, even though they are not necessary interchangeable between each other.
equals
in class Marshaller<T>
true
if this object is the same as the obj
argument; false
otherwise.public abstract int hashCode()
equals
.hashCode
in class Marshaller<T>
Copyright © 2002–2025 Devexperts LLC. All rights reserved.