Class GenericObjectSerializer
- java.lang.Object
-
- com.sun.xml.rpc.encoding.SerializerBase
-
- com.sun.xml.rpc.encoding.ObjectSerializerBase
-
- com.sun.xml.rpc.encoding.GenericObjectSerializer
-
- All Implemented Interfaces:
CombinedSerializer,Initializable,JAXRPCDeserializer,JAXRPCSerializer,SerializerConstants,Serializable,javax.xml.rpc.encoding.Deserializer,javax.xml.rpc.encoding.Serializer
- Direct Known Subclasses:
ValueTypeSerializer
public class GenericObjectSerializer extends ObjectSerializerBase implements Initializable
A data-driven (de)serializer.- Author:
- JAX-RPC Development Team
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGenericObjectSerializer.GetterMethodstatic classGenericObjectSerializer.MemberInfostatic interfaceGenericObjectSerializer.SetterMethodprotected classGenericObjectSerializer.SOAPGenericObjectInstanceBuilder
-
Field Summary
Fields Modifier and Type Field Description protected MapjavaToXmlTypeprotected Listmembersprotected InternalTypeMappingRegistryregistryprotected ClasstargetClassprotected MapxmlToJavaType-
Fields inherited from class com.sun.xml.rpc.encoding.SerializerBase
encodeType, encodingStyle, isNullable, type
-
Fields inherited from interface com.sun.xml.rpc.encoding.SerializerConstants
DONT_ENCODE_TYPE, DONT_SERIALIZE_AS_REF, ENCODE_TYPE, NOT_NULLABLE, NOT_REFERENCEABLE, NULLABLE, REFERENCEABLE, REFERENCED_INSTANCE, SERIALIZE_AS_REF, UNREFERENCED_INSTANCE
-
-
Constructor Summary
Constructors Constructor Description GenericObjectSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle)GenericObjectSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle, SOAPVersion ver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMember(GenericObjectSerializer.MemberInfo member)voidaddTypeRelation(Class javaType, QName xmlType)voidclearMembers()protected ObjectdoDeserialize(SOAPDeserializationState state, XMLReader reader, SOAPDeserializationContext context)Deserialize each element coming out ofreaderintostatewith the aid ofcontextprotected voiddoSerializeInstance(Object instance, XMLWriter writer, SOAPSerializationContext context)Serialize each data member ofobjintowriterwith the aid ofcontextprotected voiddoSetTargetClass(Class targetClass)protected ListgetMemberOrder(Object instance, List membersAlphabetically)voidinitialize(InternalTypeMappingRegistry registry)Allows the implementors to retrieve and cache serializers during system intializationvoidsetTargetClass(Class targetClass)-
Methods inherited from class com.sun.xml.rpc.encoding.ObjectSerializerBase
deserialize, doSerializeAttributes, registerWithMemberState, serialize, serializeNull
-
Methods inherited from class com.sun.xml.rpc.encoding.SerializerBase
decodeBoolean, deserialize, getEncodeType, getEncodingStyle, getID, getInnermostSerializer, getMechanismType, getName, getNullStatus, getType, getXmlType, isAcceptableType, isNullable, skipEmptyContent, typeIsEmpty, verifyName, verifyType
-
-
-
-
Field Detail
-
targetClass
protected Class targetClass
-
members
protected List members
-
xmlToJavaType
protected Map xmlToJavaType
-
javaToXmlType
protected Map javaToXmlType
-
registry
protected InternalTypeMappingRegistry registry
-
-
Constructor Detail
-
GenericObjectSerializer
public GenericObjectSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle)
-
GenericObjectSerializer
public GenericObjectSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle, SOAPVersion ver)
-
-
Method Detail
-
setTargetClass
public void setTargetClass(Class targetClass)
-
doSetTargetClass
protected void doSetTargetClass(Class targetClass)
-
initialize
public void initialize(InternalTypeMappingRegistry registry) throws Exception
Description copied from interface:InitializableAllows the implementors to retrieve and cache serializers during system intialization- Specified by:
initializein interfaceInitializable- Throws:
Exception- This exception may be thrown if there is a problem initializing
-
clearMembers
public void clearMembers()
-
addMember
public void addMember(GenericObjectSerializer.MemberInfo member) throws Exception
- Throws:
Exception
-
doSerializeInstance
protected void doSerializeInstance(Object instance, XMLWriter writer, SOAPSerializationContext context) throws Exception
Description copied from class:ObjectSerializerBaseSerialize each data member ofobjintowriterwith the aid ofcontext- Specified by:
doSerializeInstancein classObjectSerializerBase- Throws:
Exception
-
doDeserialize
protected Object doDeserialize(SOAPDeserializationState state, XMLReader reader, SOAPDeserializationContext context) throws Exception
Description copied from class:ObjectSerializerBaseDeserialize each element coming out ofreaderintostatewith the aid ofcontextExample:
protected Object doDeserialize(SOAPDeserializationState state, XMLReader reader, SOAPDeserializationContext context) throws Exception { Foo instance = new Foo(); Foo_SOAPBuilder builder = null; Object member; boolean isComplete = true; QName elementName; reader.nextElementContent(); elementName = reader.getName(); if (elementName.equals(FooMember_QNAME)) { // check to see if this is the name of the next expected member member = FooMemberDeserializer.deserialize(FooMember_QNAME, reader, context); if (member instanceof SOAPDeserializationState) { if (builder == null) { builder = new FooMemberBuilder(); } state = registerWithMemberState(instance, state, member, MEMBER_INDEX, builder); // MEMBER_INDEX is the index of the member within the object isComplete = false; } else { instance.setMember((FooMember)member); // "setMember" is whatever setter is appropriate for the member } } reader.nextElementContent(); XMLReaderUtil.verifyReaderState(reader, XMLReader.END); return (isComplete ? (Object)instance : (Object)state); }- Specified by:
doDeserializein classObjectSerializerBase- Throws:
Exception
-
-