public class BeanSerializer extends Object implements Serializer, Serializable
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log |
protected BeanPropertyDescriptor[] |
propertyDescriptor |
protected TypeDesc |
typeDesc |
Constructor and Description |
---|
BeanSerializer(Class javaType,
QName xmlType) |
BeanSerializer(Class javaType,
QName xmlType,
TypeDesc typeDesc) |
BeanSerializer(Class javaType,
QName xmlType,
TypeDesc typeDesc,
BeanPropertyDescriptor[] propertyDescriptor) |
Modifier and Type | Method and Description |
---|---|
String |
getMechanismType()
Gets 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 list
|
void |
serialize(QName name,
Attributes attributes,
Object value,
SerializationContext context)
Serialize a bean.
|
protected void |
writeAttribute(Types types,
String fieldName,
Class fieldType,
QName fieldXmlType,
Element where)
write aa attribute element and append it to the 'where' Node
|
protected 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 types
|
Element |
writeSchema(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.
|
protected static org.apache.commons.logging.Log log
protected BeanPropertyDescriptor[] propertyDescriptor
protected TypeDesc typeDesc
public BeanSerializer(Class javaType, QName xmlType, TypeDesc typeDesc, BeanPropertyDescriptor[] propertyDescriptor)
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException
name
- is the element nameattributes
- are the attributes...serialize is free to add more.value
- is the valuecontext
- is the SerializationContextIOException
public String getMechanismType()
Serializer
getMechanismType
in interface Serializer
public Element writeSchema(Class javaType, Types types) throws Exception
protected void writeField(Types types, String fieldName, QName xmlType, Class fieldType, boolean isUnbounded, boolean isOmittable, Element where, boolean isAnonymous, QName itemQName) throws Exception
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
- Exception
protected void writeAttribute(Types types, String fieldName, Class fieldType, QName fieldXmlType, Element where) throws Exception
fieldName
- name of the fieldfieldType
- type of the fieldwhere
- location for the generated schema nodeException
protected Attributes getObjectAttributes(Object value, Attributes attributes, SerializationContext context)
value
- the object we are serializingCopyright © The Apache Software Foundation. All Rights Reserved.