Apache CXF API

org.apache.cxf.aegis.type.basic
Class BeanType

java.lang.Object
  extended by org.apache.cxf.aegis.type.AegisType
      extended by org.apache.cxf.aegis.type.basic.BeanType
Direct Known Subclasses:
StructType

public class BeanType
extends AegisType

Serializes JavaBeans. There's a really dangerous coding convention in this class, maintainers beware. There are two constructor. The no-args constructor defers, until later, the construction of a BeanTypeInfo. The one-arg constructor gets the BeanTypeInfo passed as a parameter. Aegis doesn't have any uniform discipline of 'construct, set properties, initialize'. Instead, each piece of code that uses the type info needs to call getTypeInfo() instead of referencing the 'info' field.


Field Summary
 
Fields inherited from class org.apache.cxf.aegis.type.AegisType
typeClass
 
Constructor Summary
BeanType()
          Construct a type info.
BeanType(BeanTypeInfo info)
          Construct a type info given a full BeanTypeInfo.
 
Method Summary
protected  boolean alwaysAllowNillables()
           
protected  Object createFromFault(Context context)
          If the class is an exception, this will try and instantiate it with information from the XFireFault (if it exists).
 BeanTypeInfo createTypeInfo()
          Create type info based in the type class.
protected  BeanTypeInfo getBeanTypeInfoWithProperty(QName name)
           
 Set<AegisType> getDependencies()
          Return a set of AegisType dependencies.
protected  AegisType getElementType(QName name, BeanTypeInfo beanTypeInfo, MessageReader reader, Context context)
           
 long getMinOccurs()
          
 AegisType getSuperType()
          Return the AegisType for the superclass if this type's class, if any.
 BeanTypeInfo getTypeInfo()
          Return the type info.
 boolean hasMinOccurs()
           
 boolean isComplex()
          We need to write a complex type schema for Beans, so return true.
 Object readObject(MessageReader reader, Context context)
          Read in the XML fragment and create an object.
protected  Object readProperty(Object object, QName name)
           
 void setTypeClass(Type typeClass)
          
 void setTypeMapping(TypeMapping typeMapping)
           
 String toString()
          
protected  void writeElement(QName name, Object value, AegisType type, MessageWriter writer, Context context)
           
 void writeObject(Object object, MessageWriter writer, Context context)
          Writes the object to the MessageWriter.
protected  void writeProperty(QName name, Object object, Object property, Class impl, BeanTypeInfo inf)
          Write the specified property to a field.
 void writeSchema(org.apache.ws.commons.schema.XmlSchema root)
          If this type should correspond to a global, named, schema type, here is where the type object adds it to the schema.
 
Methods inherited from class org.apache.cxf.aegis.type.AegisType
addToSchemaElement, equals, getMaxOccurs, getSchemaType, getType, getTypeClass, getTypeMapping, hashCode, hasMaxOccurs, isAbstract, isFlatArray, isNillable, isWriteOuter, setAbstract, setFlatArray, setNillable, setSchemaType, setWriteOuter, usesUtilityTypes, usesXmime
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanType

public BeanType()
Construct a type info. Caller must pass in the type class via setTypeClass later.


BeanType

public BeanType(BeanTypeInfo info)
Construct a type info given a full BeanTypeInfo.

Parameters:
info -
Method Detail

readObject

public Object readObject(MessageReader reader,
                         Context context)
                  throws DatabindingException
Read in the XML fragment and create an object.

Specified by:
readObject in class AegisType
Returns:
Throws:
DatabindingException

alwaysAllowNillables

protected boolean alwaysAllowNillables()

getElementType

protected AegisType getElementType(QName name,
                                   BeanTypeInfo beanTypeInfo,
                                   MessageReader reader,
                                   Context context)

createFromFault

protected Object createFromFault(Context context)
                          throws SecurityException,
                                 InstantiationException,
                                 IllegalAccessException,
                                 IllegalArgumentException,
                                 InvocationTargetException
If the class is an exception, this will try and instantiate it with information from the XFireFault (if it exists).

Throws:
SecurityException
InstantiationException
IllegalAccessException
IllegalArgumentException
InvocationTargetException

writeProperty

protected void writeProperty(QName name,
                             Object object,
                             Object property,
                             Class impl,
                             BeanTypeInfo inf)
                      throws DatabindingException
Write the specified property to a field.

Throws:
DatabindingException

writeObject

public void writeObject(Object object,
                        MessageWriter writer,
                        Context context)
                 throws DatabindingException
Writes the object to the MessageWriter.

Specified by:
writeObject in class AegisType
Throws:
DatabindingException

writeElement

protected void writeElement(QName name,
                            Object value,
                            AegisType type,
                            MessageWriter writer,
                            Context context)

readProperty

protected Object readProperty(Object object,
                              QName name)

setTypeClass

public void setTypeClass(Type typeClass)

Overrides:
setTypeClass in class AegisType
Parameters:
typeClass - The typeClass to set.

isComplex

public boolean isComplex()
We need to write a complex type schema for Beans, so return true.

Overrides:
isComplex in class AegisType
Returns:
True if a complex type schema must be written.
See Also:
AegisType.isComplex()

getDependencies

public Set<AegisType> getDependencies()
Return a set of AegisType dependencies. Returns null if this type has no dependencies.

Overrides:
getDependencies in class AegisType
Returns:
Set of AegisType dependencies

getBeanTypeInfoWithProperty

protected BeanTypeInfo getBeanTypeInfoWithProperty(QName name)

getSuperType

public AegisType getSuperType()
Return the AegisType for the superclass if this type's class, if any.

Returns:

getTypeInfo

public BeanTypeInfo getTypeInfo()
Return the type info.

Returns:

createTypeInfo

public BeanTypeInfo createTypeInfo()
Create type info based in the type class.

Returns:

toString

public String toString()

Overrides:
toString in class AegisType

getMinOccurs

public long getMinOccurs()

Overrides:
getMinOccurs in class AegisType

hasMinOccurs

public boolean hasMinOccurs()
Overrides:
hasMinOccurs in class AegisType

setTypeMapping

public void setTypeMapping(TypeMapping typeMapping)
Overrides:
setTypeMapping in class AegisType
Parameters:
typeMapping - The typeMapping to set.

writeSchema

public void writeSchema(org.apache.ws.commons.schema.XmlSchema root)
Description copied from class: AegisType
If this type should correspond to a global, named, schema type, here is where the type object adds it to the schema.

Overrides:
writeSchema in class AegisType
Parameters:
root - root of the XSD document.

Apache CXF API

Apache CXF