Package org.apache.cxf.aegis.type.basic
Class BeanType
- java.lang.Object
-
- org.apache.cxf.aegis.type.AegisType
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description BeanType()Construct a type info.BeanType(BeanTypeInfo info)Construct a type info given a full BeanTypeInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanalwaysAllowNillables()protected ObjectcreateFromFault(Context context)If the class is an exception, this will try and instantiate it with information from the XFireFault (if it exists).BeanTypeInfocreateTypeInfo()Create type info based in the type class.protected BeanTypeInfogetBeanTypeInfoWithProperty(QName name)Set<AegisType>getDependencies()Return a set of AegisType dependencies.protected AegisTypegetElementType(QName name, BeanTypeInfo beanTypeInfo, MessageReader reader, Context context)longgetMinOccurs()AegisTypegetSuperType()Return the AegisType for the superclass if this type's class, if any.BeanTypeInfogetTypeInfo()Return the type info.booleanhasMinOccurs()booleanisComplex()We need to write a complex type schema for Beans, so return true.ObjectreadObject(MessageReader reader, Context context)Read in the XML fragment and create an object.protected ObjectreadProperty(Object object, QName name)voidsetTypeClass(Type typeClass)voidsetTypeMapping(TypeMapping typeMapping)StringtoString()protected voidwriteElement(QName name, Object value, AegisType type, MessageWriter writer, Context context)voidwriteObject(Object object, MessageWriter writer, Context context)Writes the object to the MessageWriter.protected voidwriteProperty(QName name, Object object, Object property, Class<?> impl, BeanTypeInfo inf)Write the specified property to a field.voidwriteSchema(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
-
-
-
-
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:
readObjectin classAegisType- 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, InvocationTargetException, NoSuchMethodException
If the class is an exception, this will try and instantiate it with information from the XFireFault (if it exists).
-
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:
writeObjectin classAegisType- Throws:
DatabindingException
-
writeElement
protected void writeElement(QName name, Object value, AegisType type, MessageWriter writer, Context context)
-
setTypeClass
public void setTypeClass(Type typeClass)
- Overrides:
setTypeClassin classAegisType- Parameters:
typeClass- The typeClass to set.
-
isComplex
public boolean isComplex()
We need to write a complex type schema for Beans, so return true.- Overrides:
isComplexin classAegisType- 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:
getDependenciesin classAegisType- Returns:
- Set of
AegisTypedependencies
-
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:
-
getMinOccurs
public long getMinOccurs()
- Overrides:
getMinOccursin classAegisType
-
hasMinOccurs
public boolean hasMinOccurs()
- Overrides:
hasMinOccursin classAegisType
-
setTypeMapping
public void setTypeMapping(TypeMapping typeMapping)
- Overrides:
setTypeMappingin classAegisType- Parameters:
typeMapping- The typeMapping to set.
-
writeSchema
public void writeSchema(org.apache.ws.commons.schema.XmlSchema root)
Description copied from class:AegisTypeIf this type should correspond to a global, named, schema type, here is where the type object adds it to the schema.- Overrides:
writeSchemain classAegisType- Parameters:
root- root of the XSD document.
-
-