Package org.jboss.marshalling
Class Pair.Externalizer
- java.lang.Object
-
- org.jboss.marshalling.Pair.Externalizer
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,Externalizer
public static final class Pair.Externalizer extends java.lang.Object implements Externalizer, java.io.Externalizable
An externalizer forPairinstances.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static Pair.Externalizerinstanceprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description Externalizer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcreateExternal(java.lang.Class<?> subjectType, java.io.ObjectInput input, Creator defaultCreator)Create an instance of a type.static Pair.ExternalizergetInstance()Get the single instance.voidreadExternal(java.io.ObjectInput in)voidreadExternal(java.lang.Object subject, java.io.ObjectInput input)Read the external representation of an object.protected java.lang.ObjectreadResolve()Resolve the object to the single externalizer instance.voidwriteExternal(java.io.ObjectOutput out)voidwriteExternal(java.lang.Object subject, java.io.ObjectOutput output)Write the external representation of an object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
instance
private static final Pair.Externalizer instance
-
-
Method Detail
-
getInstance
public static Pair.Externalizer getInstance()
Get the single instance. Though multiple instances can be created using the public constructor, only a single instance need be used in practice since this class maintains no internal state.- Returns:
- the instance
-
writeExternal
public void writeExternal(java.lang.Object subject, java.io.ObjectOutput output) throws java.io.IOExceptionWrite the external representation of an object. The object's class and the externalizer's class will already have been written.- Specified by:
writeExternalin interfaceExternalizer- Parameters:
subject- the object to externalizeoutput- the output- Throws:
java.io.IOException- if an error occurs
-
createExternal
public java.lang.Object createExternal(java.lang.Class<?> subjectType, java.io.ObjectInput input, Creator defaultCreator) throws java.io.IOException, java.lang.ClassNotFoundExceptionCreate an instance of a type. The object may then be initialized frominput, or that may be deferred to thereadExternal()method. Instances may simply delegate the task to the givenCreator. Note that this method is called only on the leaf class, so externalizers for non-final classes that initialize the instance from the stream need to be aware of this.- Specified by:
createExternalin interfaceExternalizer- Parameters:
subjectType- the type of object to createinput- the inputdefaultCreator- the configured creator- Returns:
- the new instance
- Throws:
java.io.IOException- if an error occursjava.lang.ClassNotFoundException- if a class could not be found during read
-
readExternal
public void readExternal(java.lang.Object subject, java.io.ObjectInput input)Read the external representation of an object. The object will already be instantiated, but may be uninitialized, when this method is called.- Specified by:
readExternalin interfaceExternalizer- Parameters:
subject- the object to readinput- the input
-
writeExternal
public void writeExternal(java.io.ObjectOutput out)
- Specified by:
writeExternalin interfacejava.io.Externalizable
-
readExternal
public void readExternal(java.io.ObjectInput in)
- Specified by:
readExternalin interfacejava.io.Externalizable
-
readResolve
protected java.lang.Object readResolve()
Resolve the object to the single externalizer instance.- Returns:
- the instance
-
-