Novell exteNd Web Services SDK API

com.sssw.jbroker.web.encoding
Class ValueTypeMarshaler

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

public class ValueTypeMarshaler
extends Object
implements Marshaler

General purpose marshaler for serializing Java Beans. Only the read/write properties are marshaled.

Since:
jBroker Web 2.0
See Also:
Serialized Form

Constructor Summary
ValueTypeMarshaler()
          Construct a ValueTypeMarshaler, which can marshal any type.
ValueTypeMarshaler(Class javaType)
          Construct a ValueTypeMarshaler, which prefers to marshal javaType.
ValueTypeMarshaler(Class javaType, PropertyDescriptor[] propDescs, Field[] fields)
          Construct a ValueTypeMarshaler, which prefers to marshal javaType.
 
Method Summary
 Object deserialize(InputStream is, Class javaType)
          Initialize the given bean object from the given input stream
 Attribute[] getAttributes(Object obj)
          Get the element attributes
 String getMechanismType()
          Get the serializer's mechanism type.
static TypeMap getTypeMap(Class javaType)
          returns the java to xml TypeMap for the parameter type
static boolean isJAXRPCValueType(Class type)
          returns true if the type is a JAX-RPC value type.
 void serialize(OutputStream os, Object obj)
          Serialize the given bean object to the given output stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueTypeMarshaler

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


ValueTypeMarshaler

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

Parameters:
javaType - The preferred Java type.

ValueTypeMarshaler

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

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

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

getAttributes

public Attribute[] getAttributes(Object obj)
Get the element attributes

Specified by:
getAttributes in interface Serializer
Parameters:
obj - the object that is being serialized
Returns:
an array of attributes for the serialzied object

serialize

public void serialize(OutputStream os,
                      Object obj)
               throws IOException
Serialize the given bean object to the given output stream

Specified by:
serialize in interface Serializer
Parameters:
os - the portable output stream
obj - the object to write
Throws:
IOException - if an I/O exception occurred during write

deserialize

public Object deserialize(InputStream is,
                          Class javaType)
                   throws IOException
Initialize the given bean object from the given input stream

Specified by:
deserialize in interface Deserializer
Parameters:
is - the input stream to read object from
javaType - the expected Java type
Returns:
a newly created object initialized from stream
Throws:
IOException - if an I/O exception occurred duing read

isJAXRPCValueType

public static boolean isJAXRPCValueType(Class type)
returns true if the type is a JAX-RPC value type.


getTypeMap

public static TypeMap getTypeMap(Class javaType)
returns the java to xml TypeMap for the parameter type


Novell exteNd Web Services SDK API

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