Novell exteNd Web Services SDK API

com.sssw.jbroker.web.encoding
Class PublicFieldsMarshaler

java.lang.Object
  extended bycom.sssw.jbroker.web.encoding.PublicFieldsMarshaler
All Implemented Interfaces:
Deserializer, Deserializer, Marshaler, Serializable, Serializer, Serializer

public class PublicFieldsMarshaler
extends Object
implements Marshaler

General purpose marshaler for serializing public fields of an object.

Since:
jBroker Web 2.0
See Also:
Serialized Form

Constructor Summary
PublicFieldsMarshaler()
          Construct a PublicFieldsMarshaler, which can marshal any type.
PublicFieldsMarshaler(Class javaType)
          Construct a PublicFieldsMarshaler, which prefers to marshal javaType.
PublicFieldsMarshaler(Class javaType, Field[] fields)
          Construct a PublicFieldsMarshaler, which prefers to marshal javaType.
 
Method Summary
 Object deserialize(InputStream is, Class javaType)
          De-serialize the public fields of some object.
 Attribute[] getAttributes(Object obj)
          This marshaler has no attributes.
 String getMechanismType()
          Get the serializer's mechanism type.
 void serialize(OutputStream os, Object obj)
          Serialize the public fields of some object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicFieldsMarshaler

public PublicFieldsMarshaler()
Construct a PublicFieldsMarshaler, which can marshal any type.


PublicFieldsMarshaler

public PublicFieldsMarshaler(Class javaType)
Construct a PublicFieldsMarshaler, which prefers to marshal javaType. The marshaler can still marshall other objects, but will perform better with javaType. The fields will be marshaled in the order they are returned by the java.lang.reflect.Fields getFields method.

Parameters:
javaType - The preferred Java type.

PublicFieldsMarshaler

public PublicFieldsMarshaler(Class javaType,
                             Field[] fields)
Construct a PublicFieldsMarshaler, which prefers to marshal javaType. The marshaler can still marshall other objects, but will perform better with javaType.

Parameters:
javaType - The preferred Java type.
fields - The fields in the order they will be marshaled.
Method Detail

getAttributes

public Attribute[] getAttributes(Object obj)
This marshaler has no attributes.

Specified by:
getAttributes in interface Serializer
Parameters:
obj - the object that is being serialized
Returns:
Always returns null.

serialize

public void serialize(OutputStream os,
                      Object obj)
               throws IOException
Serialize the public fields of some object.

Specified by:
serialize in interface Serializer
Parameters:
os - The output stream.
obj - The object to marshal. If an order has been requested for the fields, the marshaler will write the fields in that order.
Throws:
IOException - If marshaling failed.

deserialize

public Object deserialize(InputStream is,
                          Class javaType)
                   throws IOException
De-serialize the public fields of some object. The de-serializer relies on tag names in the XML to set the appropriate field. If the XML has no tag name, the de-serializer will set the fields in the order requested in the constructor.

Specified by:
deserialize in interface Deserializer
Parameters:
is - The input stream.
javaType - The expected type. Always ignored.
Returns:
a newly created object initialized from stream
Throws:
IOException - If marshaling failed.

getMechanismType

public String getMechanismType()
Get the serializer's mechanism type. Not used by jBroker Web.

Specified by:
getMechanismType in interface Serializer
Returns:
string with mechanism type

Novell exteNd Web Services SDK API

exteNd is a registered trademark of Novell, Inc.
Copyright 1998-2003 Novell, Inc. All Rights Reserved.