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

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

public class BeanType
extends Type

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.Type
typeClass
 
Constructor Summary
BeanType()
          Construct a type info.
BeanType(BeanTypeInfo info)
          Construct a type info given a full BeanTypeInfo.
 
Method Summary
protected  java.lang.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(javax.xml.namespace.QName name)
           
 java.util.Set<Type> getDependencies()
          Return a set of Type dependencies.
protected  Type getElementType(javax.xml.namespace.QName name, BeanTypeInfo beanTypeInfo, MessageReader reader, Context context)
           
 long getMinOccurs()
          
 Type getSuperType()
          Return the Type 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.
 java.lang.Object readObject(MessageReader reader, Context context)
          Read in the XML fragment and create an object.
protected  java.lang.Object readProperty(java.lang.Object object, javax.xml.namespace.QName name)
           
 void setTypeClass(java.lang.Class typeClass)
          
 void setTypeMapping(TypeMapping typeMapping)
           
 java.lang.String toString()
          
protected  void writeElement(javax.xml.namespace.QName name, java.lang.Object value, Type type, MessageWriter writer, Context context)
           
 void writeObject(java.lang.Object object, MessageWriter writer, Context context)
          Writes the object to the MessageWriter.
protected  void writeProperty(javax.xml.namespace.QName name, java.lang.Object object, java.lang.Object property, java.lang.Class impl, BeanTypeInfo inf)
          Write the specified property to a field.
 void writeSchema(org.jdom.Element 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.Type
addToSchemaElement, equals, getMaxOccurs, getSchemaType, getTypeClass, getTypeMapping, hashCode, hasMaxOccurs, isAbstract, isNillable, isWriteOuter, setAbstract, 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 java.lang.Object readObject(MessageReader reader,
                                   Context context)
                            throws DatabindingException
Read in the XML fragment and create an object.

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

getElementType

protected Type getElementType(javax.xml.namespace.QName name,
                              BeanTypeInfo beanTypeInfo,
                              MessageReader reader,
                              Context context)

createFromFault

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

Throws:
java.lang.SecurityException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException

writeProperty

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

Throws:
DatabindingException

writeObject

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

Specified by:
writeObject in class Type
Throws:
DatabindingException

writeElement

protected void writeElement(javax.xml.namespace.QName name,
                            java.lang.Object value,
                            Type type,
                            MessageWriter writer,
                            Context context)

readProperty

protected java.lang.Object readProperty(java.lang.Object object,
                                        javax.xml.namespace.QName name)

writeSchema

public void writeSchema(org.jdom.Element root)
Description copied from class: Type
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 Type
Parameters:
root - root of the XSD document.
See Also:
Type.writeSchema(org.jdom.Element)

setTypeClass

public void setTypeClass(java.lang.Class typeClass)

Overrides:
setTypeClass in class Type
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 Type
Returns:
True if a complex type schema must be written.
See Also:
Type.isComplex()

getDependencies

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

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

getBeanTypeInfoWithProperty

protected BeanTypeInfo getBeanTypeInfoWithProperty(javax.xml.namespace.QName name)

getSuperType

public Type getSuperType()
Return the Type 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 java.lang.String toString()

Overrides:
toString in class Type

getMinOccurs

public long getMinOccurs()

Overrides:
getMinOccurs in class Type

hasMinOccurs

public boolean hasMinOccurs()
Overrides:
hasMinOccurs in class Type

setTypeMapping

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


Apache CXF