Package org.apache.axis.encoding.ser
Class BeanSerializer
java.lang.Object
org.apache.axis.encoding.ser.BeanSerializer
- All Implemented Interfaces:
Serializable
,Serializer
,Serializer
General purpose serializer/deserializerFactory for an arbitrary java bean.
- Author:
- Sam Ruby <rubys@us.ibm.com>, Rich Scheuerle <scheu@us.ibm.com>, Tom Jordahl <tomj@macromedia.com>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.apache.commons.logging.Log
protected BeanPropertyDescriptor[]
protected TypeDesc
-
Constructor Summary
ConstructorsConstructorDescriptionBeanSerializer
(Class javaType, QName xmlType) BeanSerializer
(Class javaType, QName xmlType, TypeDesc typeDesc) BeanSerializer
(Class javaType, QName xmlType, TypeDesc typeDesc, BeanPropertyDescriptor[] propertyDescriptor) -
Method Summary
Modifier and TypeMethodDescriptionGets the type of the XML processing mechanism and representation used by this Serializer.protected Attributes
getObjectAttributes
(Object value, Attributes attributes, SerializationContext context) Check for meta-data in the bean that will tell us if any of the properties are actually attributes, add those to the element attribute listvoid
serialize
(QName name, Attributes attributes, Object value, SerializationContext context) Serialize a bean.protected void
write aa attribute element and append it to the 'where' Nodeprotected void
writeField
(Types types, String fieldName, QName xmlType, Class fieldType, boolean isUnbounded, boolean isOmittable, Element where, boolean isAnonymous, QName itemQName) write a schema representation of the given Class field and append it to the where Node, recurse on complex typeswriteSchema
(Class javaType, Types types) Return XML schema for the specified type, suitable for insertion into the <types> element of a WSDL document, or underneath an <element> or <attribute> declaration.
-
Field Details
-
log
protected static org.apache.commons.logging.Log log -
propertyDescriptor
-
typeDesc
-
-
Constructor Details
-
BeanSerializer
-
BeanSerializer
-
BeanSerializer
public BeanSerializer(Class javaType, QName xmlType, TypeDesc typeDesc, BeanPropertyDescriptor[] propertyDescriptor)
-
-
Method Details
-
serialize
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException Serialize a bean. Done simply by serializing each bean property.- Specified by:
serialize
in interfaceSerializer
- Parameters:
name
- is the element nameattributes
- are the attributes...serialize is free to add more.value
- is the valuecontext
- is the SerializationContext- Throws:
IOException
-
getMechanismType
Description copied from interface:Serializer
Gets the type of the XML processing mechanism and representation used by this Serializer.- Specified by:
getMechanismType
in interfaceSerializer
- Returns:
- XML processing mechanism type
-
writeSchema
Return XML schema for the specified type, suitable for insertion into the <types> element of a WSDL document, or underneath an <element> or <attribute> declaration.- Specified by:
writeSchema
in interfaceSerializer
- Parameters:
javaType
- the Java Class we're writing out schema fortypes
- the Java2WSDL Types object which holds the context for the WSDL being generated.- Returns:
- a type element containing a schema simpleType/complexType
- Throws:
Exception
- See Also:
-
writeField
protected void writeField(Types types, String fieldName, QName xmlType, Class fieldType, boolean isUnbounded, boolean isOmittable, Element where, boolean isAnonymous, QName itemQName) throws Exception write a schema representation of the given Class field and append it to the where Node, recurse on complex types- Parameters:
fieldName
- name of the fieldxmlType
- the schema type of the fieldfieldType
- type of the fieldisUnbounded
- causes maxOccurs="unbounded" if setwhere
- location for the generated schema nodeitemQName
-- Throws:
Exception
-
writeAttribute
protected void writeAttribute(Types types, String fieldName, Class fieldType, QName fieldXmlType, Element where) throws Exception write aa attribute element and append it to the 'where' Node- Parameters:
fieldName
- name of the fieldfieldType
- type of the fieldwhere
- location for the generated schema node- Throws:
Exception
-
getObjectAttributes
protected Attributes getObjectAttributes(Object value, Attributes attributes, SerializationContext context) Check for meta-data in the bean that will tell us if any of the properties are actually attributes, add those to the element attribute list- Parameters:
value
- the object we are serializing- Returns:
- attributes for this element, null if none
-